-
Notifications
You must be signed in to change notification settings - Fork 9
Documentation
LudoCrypt edited this page Apr 4, 2021
·
53 revisions
I have supplied y'all with an example that includes some of the main features one might want to use.
For a real resourcepack, check out this one that has the old menu panoramas!
In a resourcepack, to create a panorama, create a panoramas.json
directly inside of assets/modid
, where sounds.json
also goes. panoramas.json
follows the same format as sounds.json
. Anything with (optional)
has the default already set in this example.
{
// The name of this entry (not locally used)
"Default Panorama": {
// The name used for config.
"name": "minecraft",
// The identifier of the textures to show.
"panoramaId": "textures/gui/title/background/panorama",
// The identifier of the music it plays. (optional)
"musicId": "music.menu",
// The movement settings (optional)
"movementSettings": {
// Does it move? (optional)
"frozen": false,
// How much to add to X. (optional)
"addedX": 0.0,
// How much to add to Y. (optional)
"addedY": 0.0,
// How fast it moves (compared to normal). (optional)
"speedMultiplier": 1.0,
// Move woozily. (optional)
"woozy": false
},
// How much this one is picked. (optional)
"weight": 1
}
}
Or use a music sound instead of an identifier. Don't use both
{
"default": {
"name": "Minecraft",
"panoramaId": "textures/gui/title/background/panorama",
// The music sound. (optional)
"musicSound": {
// The identifier of what music to play. (optional)
"sound": "music.menu",
// The minimum time to wait before it plays (in ticks). (optional)
"min_delay": 20,
// The maximum time to wait before it plays (in ticks). (optional)
"max_delay": 600,
// When this music is supposed to play, cut off the old music and play this one?. (optional)
"replace_current_music": true
},
"weight": 1
}
}
repositories {
maven {
name = 'TerraformersMC'
url = 'https://maven.terraformersmc.com/'
}
}
modImplementation "com.terraformersmc:vistas:${project.vistas_version}"
include "com.terraformersmc:vistas:${project.vistas_version}"
vistas_version=1.3.0
Get versions from here
Create a class such as the one below, variables are separated for clarity. Let's use cinderscapes as an example.
public class ExampleVistasApiImpl implements VistasApi {
@Override
public void appendPanoramas(Set<Panorama> panoramas) {
// The name that the config uses to show this panorama.
String name = "cinderscapes:panorama";
// The identifier of the panorama textures.
Identifier backgroundId = new Identifier("cinderscapes", "textures/gui/panorama/panorama");
// The music sound that the music plays from.
MusicSound music = Panorama.Builder.createMenuSound(SoundEvents.MUSIC_MENU);
// How much the panorama is chosen
int weight = 1;
// The Movement Settings
// Does the panorama move?
boolean frozen = false;
// How much to add on the X axis
float addedX = 0.0F;
// How much to add on the Y axis
float addedY = 0.0F;
// How fast it moves (compared to normal)
float speedMultiplier = 1.0F;
// Move woozily
boolean woozy = false;
// Or just use your own equations for it. These are optional and are by default turned off.
// Y'know, just put whatever
Function<Float, Float> XEquation = (time) -> {
return (float)Math.sin(time * 5) * 38;
};
Function<Float, Float> YEquation = (time) -> {
return (float)Math.sin(time * 15) * 69;
};
Panorama defaultPanorama = new Panorama.Builder(name)
.setBackgroundId(backgroundId)
.setMusic(music)
.setWeight(weight)
.setFrozen(frozen)
.setAddedX(addedX)
.setAddedY(addedY)
.setSpeedMultiplier(speedMultiplier)
.setWoozy(woozy)
// Again, these things are optional
.setXEquation(XEquation)
.setYEquation(YEquation)
.build();
panoramas.add(defaultPanorama);
}
}
Add the class you just made into an entrypoint to your fabric.mod.json, such as this one here
"entrypoints": {
"vistas": [ "com.example.mod.ExampleVistasApiImpl" ]
}