use of org.spongepowered.api.data.type.BoatType in project SpongeCommon by SpongePowered.
the class BoatData method register.
// @formatter:off
public static void register(final DataProviderRegistrator registrator) {
registrator.asMutable(Boat.class).create(Keys.BOAT_TYPE).get(h -> ((BoatType) (Object) h.getBoatType())).set((h, v) -> h.setType((Boat.Type) (Object) v)).asMutable(BoatAccessor.class).create(Keys.IS_IN_WATER).get(h -> h.accessor$status() == Boat.Status.IN_WATER).asMutable(BoatBridge.class).create(Keys.CAN_MOVE_ON_LAND).get(BoatBridge::bridge$getMoveOnLand).set(BoatBridge::bridge$setMoveOnLand).asMutable(BoatBridge.class).create(Keys.OCCUPIED_DECELERATION).get(BoatBridge::bridge$getOccupiedDecelerationSpeed).set(BoatBridge::bridge$setOccupiedDecelerationSpeed).asMutable(BoatBridge.class).create(Keys.MAX_SPEED).get(BoatBridge::bridge$getMaxSpeed).set(BoatBridge::bridge$setMaxSpeed).asMutable(BoatBridge.class).create(Keys.UNOCCUPIED_DECELERATION).get(BoatBridge::bridge$getUnoccupiedDecelerationSpeed).set(BoatBridge::bridge$setUnoccupiedDecelerationSpeed);
final ResourceKey boatDataStoreKey = ResourceKey.sponge("boat");
registrator.spongeDataStore(boatDataStoreKey, 2, new DataContentUpdater[] { BoatData.BOAT_UPDATER_BYTE_TO_BOOL_FIX }, BoatBridge.class, Keys.MAX_SPEED, Keys.CAN_MOVE_ON_LAND, Keys.OCCUPIED_DECELERATION, Keys.UNOCCUPIED_DECELERATION);
SpongeDataManager.INSTANCE.registerLegacySpongeData(Constants.Entity.Boat.BOAT_MAX_SPEED, boatDataStoreKey, Keys.MAX_SPEED);
SpongeDataManager.INSTANCE.registerLegacySpongeData(Constants.Entity.Boat.BOAT_MOVE_ON_LAND, boatDataStoreKey, Keys.CAN_MOVE_ON_LAND);
SpongeDataManager.INSTANCE.registerLegacySpongeData(Constants.Entity.Boat.BOAT_OCCUPIED_DECELERATION_SPEED, boatDataStoreKey, Keys.OCCUPIED_DECELERATION);
SpongeDataManager.INSTANCE.registerLegacySpongeData(Constants.Entity.Boat.BOAT_UNOCCUPIED_DECELERATION_SPEED, boatDataStoreKey, Keys.UNOCCUPIED_DECELERATION);
}
Aggregations