Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/coaster_yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ There's a lot more types of tracks available, including transfers, launches, and
- **identifier**: your_ride_identifier, same as used in the folder name and file names
- **displayName**: The visible name of the coaster in-game
- **displayDescription**: The visible description of the coaster in-game
- **useDisplayEntities**: Whether to use display entities instead of armor stands for the coaster carts
- **displayItem**: The visible icon (item in inventory) of the coaster in-game
- - **material**: Icon material
- - **damage**: Damage property
Expand Down Expand Up @@ -204,6 +205,7 @@ There's a lot more types of tracks available, including transfers, launches, and
- - - - - .. and other item attributes
- - - - **position**: Model offset in [x,y,z] compared to cart origin
- - - - **rotation**: Model offset in [rx,ry,rz] compared to cart origin
- - - - **scale**: Scale of the model in [x,y,z]. *Only applies when the useDisplayEntities is set to true!*
- **gates**: Entry and exit gates for players to wait behind at a coaster
- - **<station_section_name>**: Name of the station section that the gates belong to
- - - **entry**:
Expand Down
2 changes: 2 additions & 0 deletions docs/flatride_yml.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ plugins/
- **identifier**: your_ride_identifier, same as used in the folder name and file names
- **displayName**: The visible name of the coaster in-game
- **displayDescription**: The visible description of the coaster in-game
- **useDisplayEntities**: Whether to use display entities for the flatride
- **displayItem**: The visible icon (item in inventory) of the coaster in-game
- - **material**: Icon material
- - **damage**: Damage property
Expand Down Expand Up @@ -100,6 +101,7 @@ plugins/
- - - - - - .. and other item attributes
- - - - - **position**: Position in [x,y,z] compared to the bone position
- - - - - **rotation**: Rotation in [rx,ry,rz] compared to the bone rotation
- - - - - **scale**: Scale of the model in [x,y,z]. *Only applies when the useDisplayEntities is set to true!*


- - - *.. Typically a bone is either a root or an arm*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ public TrackBehaviour getTrackBehaviourFor(CoasterHandle coasterHandle, CoasterC

List<ModelWithOffset> modelEntities = transferSectionSpecConfig.getTransferModelConfigs()
.stream()
.map(c -> c.toModelWithOffset(originTransferPosition.getLocation(), originTransferPosition.getOrientation().clone(), viewportManager))
.map(c -> c.toModelWithOffset(originTransferPosition.getLocation(), originTransferPosition.getOrientation().clone(), new Vector3(1, 1, 1), viewportManager))
.toList();

Transfer transfer = new Transfer(transferPositions, modelEntities, origin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ public class CoasterConfig extends AbstractRideConfig {
private final int rideOverviewMapId;

public CoasterConfig(String manifestVersion, String identifier, String displayName, List<String> displayDescription,
ItemStackConfig displayItem, PlayerLocation warpLocation, boolean warpEnabled, PlayerLocation customEjectLocation, TrackConfig track,
InteractionEntitiesConfig interactionEntities,
boolean useDisplayEntities, ItemStackConfig displayItem, PlayerLocation warpLocation, boolean warpEnabled,
PlayerLocation customEjectLocation, TrackConfig track, InteractionEntitiesConfig interactionEntities,
VehiclesConfig vehicles, CartSpecConfig cartSpec, GatesConfig gates, double gravityConstant, double dragConstant,
ControllerConfig controllerConfig, SoundsConfig soundsConfig, int rideOverviewMapId, boolean canExitDuringRide,
RideCounterMapConfigs rideCounterMapConfigs, boolean debugMode) {
super(manifestVersion, identifier, displayName, displayDescription, displayItem, warpLocation, warpEnabled, customEjectLocation, gates, soundsConfig, canExitDuringRide, interactionEntities, rideCounterMapConfigs, debugMode);
super(manifestVersion, identifier, displayName, displayDescription, useDisplayEntities, displayItem, warpLocation, warpEnabled, customEjectLocation, gates, soundsConfig, canExitDuringRide, interactionEntities, rideCounterMapConfigs, debugMode);
this.track = track;
this.vehicles = vehicles;
this.cartSpec = cartSpec;
Expand Down Expand Up @@ -95,6 +95,7 @@ public static CoasterConfig fromConfigurationSection(ConfigurationSection config
if(displayDescription.size() == 1 && ChatColor.stripColor(displayDescription.get(0)).equals(""))
displayDescription.clear();

boolean useDisplayEntities = getBoolean(configurationSection, "useDisplayEntities", false);
ItemStackConfig displayItem = ItemStackConfig.fromConfigurationSection(configurationSection.getConfigurationSection("displayItem"));
PlayerLocation warpLocation = PlayerLocation.fromDoubleList(configurationSection.getDoubleList("warpLocation"));
boolean warpEnabled = configurationSection.getBoolean("warpEnabled", true);
Expand All @@ -113,7 +114,7 @@ public static CoasterConfig fromConfigurationSection(ConfigurationSection config
RideCounterMapConfigs rideCounterMapConfigs = RideCounterMapConfigs.fromConfigurationSection(RideType.COASTER, identifier, configurationSection.getConfigurationSection("rideCounterMaps"));
boolean debugMode = getBoolean(configurationSection, "debugMode", false);

return new CoasterConfig(manifestVersion, identifier, displayName, displayDescription, displayItem, warpLocation, warpEnabled, customEjectLocation, track, interactionEntities, vehicles,
return new CoasterConfig(manifestVersion, identifier, displayName, displayDescription, useDisplayEntities, displayItem, warpLocation, warpEnabled, customEjectLocation, track, interactionEntities, vehicles,
cartSpec, gates, gravityConstant, dragConstant, controllerConfig, sounds, rideOverviewMapId,
canExitDuringRide, rideCounterMapConfigs, debugMode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ public void spawnEntities(RideHandle rideHandle){
ModelConfig modelConfig = entry.getValue();
Vector3 spawnPosition = modelConfig.getPosition();
Quaternion spawnRotation = modelConfig.getRotation();
Vector3 spawnScale = modelConfig.getScale();
String customName = "Controller";
VirtualEntity virtualEntity = modelConfig.getItemConfig().spawnEntity(viewportManager, spawnPosition, spawnRotation, customName);
VirtualEntity virtualEntity = modelConfig.getItemConfig().spawnEntity(viewportManager, spawnPosition, spawnRotation, spawnScale, customName, false);

virtualEntity.setCustomAction(new OperateRideAction());
virtualEntity.setBelongsToRide(rideHandle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,13 @@ public class ModelConfig extends BaseConfig {
private final ItemConfig itemConfig;
private final Vector3 position;
private final Quaternion rotation;
private final Vector3 scale;

public ModelConfig(ItemConfig itemConfig, Vector3 position, Quaternion rotation) {
public ModelConfig(ItemConfig itemConfig, Vector3 position, Quaternion rotation, Vector3 scale) {
this.itemConfig = itemConfig;
this.position = position;
this.rotation = rotation;
this.scale = scale;
}

public Vector3 getPosition() {
Expand All @@ -50,30 +52,35 @@ public Quaternion getRotation() {
return rotation;
}

public Vector3 getScale() {
return scale;
}

public ItemConfig getItemConfig() {
return itemConfig;
}

public ModelWithOffset toModelWithOffset(Vector3 rootPosition, ViewportManager viewportManager) {
return toModelWithOffset(rootPosition, new Quaternion(), viewportManager);
return toModelWithOffset(rootPosition, new Quaternion(), new Vector3(1, 1, 1), viewportManager);
}

public ModelWithOffset toModelWithOffset(Vector3 rootPosition, Quaternion rootOrientation, ViewportManager viewportManager){
public ModelWithOffset toModelWithOffset(Vector3 rootPosition, Quaternion rootOrientation, Vector3 rootScale, ViewportManager viewportManager){
Vector3 spawnPosition = Vector3.add(rootPosition, position);
VirtualEntity virtualEntity = itemConfig.spawnEntity(viewportManager, spawnPosition, rootOrientation, null);
VirtualEntity virtualEntity = itemConfig.spawnEntity(viewportManager, spawnPosition, rootOrientation, rootScale, null, false);

return new ModelWithOffset(virtualEntity, position.clone(), rotation.clone());
}

public static ModelConfig fromConfigurationSection(@Nullable ConfigurationSection configurationSection) {
if(configurationSection == null) return new ModelConfig(null, Vector3.zero(), new Quaternion());
if(configurationSection == null) return new ModelConfig(null, Vector3.zero(), new Quaternion(), new Vector3(1, 1, 1));

ItemConfig itemConfig = ItemConfig.fromConfigurationSection(configurationSection);

Vector3 vector = Vector3.fromDoubleList(getDoubleList(configurationSection, "position", List.of(0d,0d,0d)));
Quaternion rotation = Quaternion.fromDoubleList(getDoubleList(configurationSection, "rotation", List.of(0d,0d,0d)));
Vector3 scale = Vector3.fromDoubleList(getDoubleList(configurationSection, "scale", List.of(1d,1d,1d)));

return new ModelConfig(itemConfig, vector, rotation);
return new ModelConfig(itemConfig, vector, rotation, scale);
}

public static List<ModelConfig> multipleFromConfigurationSection(ConfigurationSection configurationSection){
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import javax.annotation.Nullable;

public class EntityConfig extends BaseConfig implements ItemConfig{
public class EntityConfig extends BaseConfig implements ItemConfig {
private final EntityType entityType;
private final double yawRotation;

Expand All @@ -41,7 +41,7 @@ public EntityType getEntityType() {
}

@Override
public VirtualEntity spawnEntity(ViewportManager viewportManager, Vector3 spawnPosition, Quaternion spawnRotation, String customName) {
public VirtualEntity spawnEntity(ViewportManager viewportManager, Vector3 spawnPosition, Quaternion spawnRotation, Vector3 spawnScale, String customName, boolean useDisplayEntities) {
return viewportManager.spawnVirtualBukkitEntity(spawnPosition, getEntityType(), yawRotation);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import javax.annotation.Nullable;

public interface ItemConfig {
VirtualEntity spawnEntity(ViewportManager viewportManager, Vector3 spawnPosition, Quaternion spawnRotation, String customName);
VirtualEntity spawnEntity(ViewportManager viewportManager, Vector3 spawnPosition, Quaternion spawnRotation, Vector3 spawnScale, String customName, boolean useDisplayEntities);

static ItemConfig fromConfigurationSection(@Nullable ConfigurationSection configurationSection){
if(configurationSection == null) return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ public ItemStack createItemStack(){
}

@Override
public VirtualEntity spawnEntity(ViewportManager viewportManager, Vector3 spawnPosition, Quaternion spawnRotation, String customName) {
return viewportManager.spawnModelEntity(spawnPosition, spawnRotation, new TrainModelItem(createItemStack()), customName);
public VirtualEntity spawnEntity(ViewportManager viewportManager, Vector3 spawnPosition, Quaternion spawnRotation, Vector3 spawnScale, String customName, boolean useDisplayEntities) {
return viewportManager.spawnModelEntity(spawnPosition, spawnRotation, spawnScale, new TrainModelItem(createItemStack()), customName, useDisplayEntities);
}

public static ItemStackConfig fromConfigurationSection(@Nullable ConfigurationSection configurationSection) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class FlatRideConfig extends AbstractRideConfig {
private final StructureConfig structureConfig;
private final TimingConfig timingConfig;

public FlatRideConfig(String manifestVersion, String identifier, String displayName, List<String> displayDescription, ItemStackConfig displayItem,
public FlatRideConfig(String manifestVersion, String identifier, String displayName, List<String> displayDescription, boolean useDisplayEntities, ItemStackConfig displayItem,
PlayerLocation warpLocation, boolean warpEnabled, PlayerLocation customEjectLocation, GatesConfig gates, InteractionEntitiesConfig interactionEntities,
boolean canExitDuringRide, StationConfig stationConfig, SoundsConfig soundsConfig, StructureConfig structureConfig,
TimingConfig timingConfig, RideCounterMapConfigs rideCounterMapConfigs, boolean debugMode) {
super(manifestVersion, identifier, displayName, displayDescription, displayItem, warpLocation, warpEnabled, customEjectLocation, gates, soundsConfig, canExitDuringRide, interactionEntities, rideCounterMapConfigs, debugMode);
super(manifestVersion, identifier, displayName, displayDescription, useDisplayEntities, displayItem, warpLocation, warpEnabled, customEjectLocation, gates, soundsConfig, canExitDuringRide, interactionEntities, rideCounterMapConfigs, debugMode);
this.stationConfig = stationConfig;
this.structureConfig = structureConfig;
this.timingConfig = timingConfig;
Expand Down Expand Up @@ -73,6 +73,7 @@ public static FlatRideConfig fromConfigurationSection(ConfigurationSection confi
if(displayDescription.size() == 1 && ChatColor.stripColor(displayDescription.get(0)).equals(""))
displayDescription.clear();

boolean useDisplayEntities = configurationSection.getBoolean("useDisplayEntities", false);
ItemStackConfig displayItem = ItemStackConfig.fromConfigurationSection(configurationSection.getConfigurationSection("displayItem"));
PlayerLocation warpLocation = PlayerLocation.fromDoubleList(configurationSection.getDoubleList("warpLocation"));
boolean warpEnabled = configurationSection.getBoolean("warpEnabled", true);
Expand All @@ -87,7 +88,7 @@ public static FlatRideConfig fromConfigurationSection(ConfigurationSection confi
RideCounterMapConfigs rideCounterMapConfigs = RideCounterMapConfigs.fromConfigurationSection(RideType.FLATRIDE, identifier, getConfigurationSection(configurationSection, "rideCounterMaps"));
boolean debugMode = getBoolean(configurationSection, "debugMode", false);

return new FlatRideConfig(manifestVersion, identifier, displayName, displayDescription, displayItem, warpLocation, warpEnabled,
return new FlatRideConfig(manifestVersion, identifier, displayName, displayDescription, useDisplayEntities, displayItem, warpLocation, warpEnabled,
customEjectLocation, gates, interactionEntities, canExitDuringRide, stationConfig, sounds, structureConfig,
timingConfig, rideCounterMapConfigs, debugMode);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public abstract class AbstractRideConfig extends BaseConfig {
private final String identifier;
private final String displayName;
private final List<String> displayDescription;
private final boolean useDisplayEntities;
private final ItemStackConfig displayItem;
private final PlayerLocation warpLocation;
private final boolean warpEnabled;
Expand All @@ -42,11 +43,12 @@ public abstract class AbstractRideConfig extends BaseConfig {
private final RideCounterMapConfigs rideCounterMapConfigs;
private final boolean debugMode;

public AbstractRideConfig(String manifestVersion, String identifier, String displayName, List<String> displayDescription, ItemStackConfig displayItem, PlayerLocation warpLocation, boolean warpEnabled, PlayerLocation customEjectLocation, GatesConfig gates, SoundsConfig soundsConfig, boolean canExitDuringRide, InteractionEntitiesConfig interactionEntities, RideCounterMapConfigs rideCounterMapConfigs, boolean debugMode) {
public AbstractRideConfig(String manifestVersion, String identifier, String displayName, List<String> displayDescription, boolean useDisplayEntities, ItemStackConfig displayItem, PlayerLocation warpLocation, boolean warpEnabled, PlayerLocation customEjectLocation, GatesConfig gates, SoundsConfig soundsConfig, boolean canExitDuringRide, InteractionEntitiesConfig interactionEntities, RideCounterMapConfigs rideCounterMapConfigs, boolean debugMode) {
this.manifestVersion = manifestVersion;
this.identifier = identifier;
this.displayName = displayName;
this.displayDescription = displayDescription;
this.useDisplayEntities = useDisplayEntities;
this.displayItem = displayItem;
this.warpLocation = warpLocation;
this.warpEnabled = warpEnabled;
Expand Down Expand Up @@ -75,6 +77,10 @@ public List<String> getDisplayDescription() {
return displayDescription;
}

public boolean isUsingDisplayEntities() {
return useDisplayEntities;
}

public ItemStackConfig getDisplayItem() {
return displayItem;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ private LocRot getSpawnLocation(){
public TrainEffectTrigger createTrigger(ViewportManager viewportManager) {
LocRot spawnLocation = getSpawnLocation();
Quaternion rotation = Quaternion.fromAnglesVector(spawnLocation.rotation());
VirtualEntity virtualEntity = itemConfig.spawnEntity(viewportManager, spawnLocation.location(), rotation, null);
VirtualEntity virtualEntity = itemConfig.spawnEntity(viewportManager, spawnLocation.location(), rotation, new Vector3(1, 1, 1), null, false);
virtualEntity.setRotation(Quaternion.fromAnglesVector(spawnLocation.rotation()));

List<EntityMovementTrigger> triggerSequence = entityMovementConfigs.stream()
Expand Down
Loading