use of org.spongepowered.api.data.type.PortionType in project LanternServer by LanternPowered.
the class KeyRegistryModule method registerDefaults.
@Override
public void registerDefaults() {
final CauseStack causeStack = CauseStack.current();
causeStack.pushCause(Lantern.getSpongePlugin());
register(makeMutableBoundedValueKey(Double.class, DataQuery.of("Absorption"), "absorption"));
register(makeValueKey(Boolean.class, of("AffectsSpawning"), "affects_spawning"));
register(makeMutableBoundedValueKey(Integer.class, of("Age"), "age"));
register(makeValueKey(Boolean.class, of("AIEnabled"), "ai_enabled"));
register(makeMutableBoundedValueKey(Integer.class, of("Anger"), "anger"));
register(makeMutableBoundedValueKey(Integer.class, DataQuery.of("AreaEffectCloudAge"), "area_effect_cloud_age"));
register(makeValueKey(Color.class, DataQuery.of("AreaEffectCloudColor"), "area_effect_cloud_color"));
register(makeMutableBoundedValueKey(Integer.class, DataQuery.of("AreaEffectCloudDuration"), "area_effect_cloud_duration"));
register(makeMutableBoundedValueKey(Integer.class, DataQuery.of("AreaEffectCloudDurationOnUse"), "area_effect_cloud_duration_on_use"));
register(makeValueKey(Color.class, DataQuery.of("AreaEffectCloudParticleType"), "area_effect_cloud_particle_type"));
register(makeMutableBoundedValueKey(Double.class, DataQuery.of("AreaEffectCloudRadius"), "area_effect_cloud_radius"));
register(makeMutableBoundedValueKey(Double.class, DataQuery.of("AreaEffectCloudRadiusOnUse"), "area_effect_cloud_radius_on_use"));
register(makeMutableBoundedValueKey(Double.class, DataQuery.of("AreaEffectCloudRadiusPerTick"), "area_effect_cloud_radius_per_tick"));
register(makeMutableBoundedValueKey(Integer.class, DataQuery.of("AreaEffectCloudRadiusReapplicationDelay"), "area_effect_cloud_reapplication_delay"));
register(makeMutableBoundedValueKey(Integer.class, DataQuery.of("AreaEffectCloudWaitTime"), "area_effect_cloud_wait_time"));
register(makeValueKey(Boolean.class, of("ArmorStandHasArms"), "armor_stand_has_arms"));
register(makeValueKey(Boolean.class, of("ArmorStandHasBasePlate"), "armor_stand_has_base_plate"));
register(makeValueKey(Boolean.class, of("ArmorStandIsSmall"), "armor_stand_is_small"));
register(makeValueKey(Boolean.class, of("ArmorStandMarker"), "armor_stand_marker"));
register(makeValueKey(Boolean.class, of("Angry"), "angry"));
register(makeValueKey(Art.class, of("Art"), "art"));
register(makeValueKey(Boolean.class, of("Attached"), "attached"));
register(makeMutableBoundedValueKey(Double.class, of("AttackDamage"), "attack_damage"));
register(makeValueKey(Axis.class, of("Axis"), "axis"));
register(makeValueKey(DyeColor.class, of("BannerBaseColor"), "banner_base_color"));
register(makePatternListKey(of("BannerPatterns"), "banner_patterns"));
register(makeMutableBoundedValueKey(Float.class, of("BaseSize"), "base_size"));
register(makeValueKey(EntitySnapshot.class, of("BaseVehicle"), "base_vehicle"));
register(makeOptionalKey(PotionEffectType.class, of("BeaconPrimaryEffect"), "beacon_primary_effect"));
register(makeOptionalKey(PotionEffectType.class, of("BeaconSecondaryEffect"), "beacon_secondary_effect"));
register(makeValueKey(BigMushroomType.class, of("BigMushroomType"), "big_mushroom_type"));
register(makeMapKeyWithKeyAndValue(BodyPart.class, Vector3d.class, of("BodyRotations"), "body_rotations"));
register(makeValueKey(Text.class, of("BookAuthor"), "book_author"));
register(makeListKey(Text.class, of("BookPages"), "book_pages"));
register(makeSetKey(BlockType.class, of("BreakableBlockTypes"), "breakable_block_types"));
register(makeValueKey(BrickType.class, of("BrickType"), "brick_type"));
register(makeValueKey(Boolean.class, of("CanBreed"), "can_breed"));
register(makeValueKey(Boolean.class, of("CanDropAsItem"), "can_drop_as_item"));
register(makeValueKey(Boolean.class, of("CanFly"), "can_fly"));
register(makeValueKey(Boolean.class, of("CanGrief"), "can_grief"));
register(makeValueKey(Boolean.class, of("CanPlaceAsBlock"), "can_place_as_block"));
register(makeValueKey(Career.class, of("Career"), "career"));
register(makeValueKey(Vector3d.class, of("ChestRotation"), "chest_rotation"));
register(makeValueKey(CoalType.class, of("CoalType"), "coal_type"));
register(makeValueKey(Color.class, of("Color"), "color"));
register(makeValueKey(String.class, of("Command"), "command"));
register(makeValueKey(ComparatorType.class, of("ComparatorType"), "comparator_type"));
register(makeSetKey(Direction.class, of("ConnectedDirections"), "connected_directions"));
register(makeValueKey(Boolean.class, of("ConnectedEast"), "connected_east"));
register(makeValueKey(Boolean.class, of("ConnectedNorth"), "connected_north"));
register(makeValueKey(Boolean.class, of("ConnectedSouth"), "connected_south"));
register(makeValueKey(Boolean.class, of("ConnectedWest"), "connected_west"));
register(makeMutableBoundedValueKey(Integer.class, of("ContainedExperience"), "contained_experience"));
register(makeValueKey(CookedFish.class, of("CookedFish"), "cooked_fish"));
register(makeMutableBoundedValueKey(Integer.class, of("Cooldown"), "cooldown"));
register(makeValueKey(Boolean.class, of("CreeperCharged"), "creeper_charged"));
register(makeValueKey(Boolean.class, of("CriticalHit"), "critical_hit"));
register(makeValueKey(Boolean.class, of("CustomNameVisible"), "custom_name_visible"));
register(makeMapKeyWithKeyAndValue(EntityType.class, Double.class, of("EntityDamageMap"), "damage_entity_map"));
register(makeValueKey(Boolean.class, of("Decayable"), "decayable"));
register(makeMutableBoundedValueKey(Integer.class, of("Delay"), "delay"));
register(makeMutableBoundedValueKey(Integer.class, of("DespawnDelay"), "despawn_delay"));
register(makeValueKey(Direction.class, of("Direction"), "direction"));
register(makeValueKey(DirtType.class, of("DirtType"), "dirt_type"));
register(makeValueKey(Boolean.class, of("Disarmed"), "disarmed"));
register(makeValueKey(DisguisedBlockType.class, of("DisguisedBlockType"), "disguised_block_type"));
register(makeValueKey(Text.class, of("DisplayName"), "display_name"));
register(makeValueKey(HandPreference.class, of("DominantHand"), "dominant_hand"));
register(makeValueKey(DoublePlantType.class, of("DoublePlantType"), "double_plant_type"));
register(makeValueKey(DyeColor.class, of("DyeColor"), "dye_color"));
register(makeValueKey(Boolean.class, of("ElderGuardian"), "elder_guardian"));
register(makeValueKey(Boolean.class, of("EndGatewayAge"), "end_gateway_age"));
register(makeValueKey(Boolean.class, of("EndGatewayTeleportCooldown"), "end_gateway_teleport_cooldown"));
register(makeMutableBoundedValueKey(Double.class, of("Exhaustion"), "exhaustion"));
register(makeValueKey(Boolean.class, of("ExactTeleport"), "exact_teleport"));
register(makeValueKey(Vector3i.class, of("ExitPosition"), "exit_position"));
register(makeImmutableBoundedValueKey(Integer.class, of("ExperienceFromStartOfLevel"), "experience_from_start_of_level"));
register(makeMutableBoundedValueKey(Integer.class, of("ExperienceLevel"), "experience_level"));
register(makeMutableBoundedValueKey(Integer.class, of("ExperienceSinceLevel"), "experience_since_level"));
register(makeMutableBoundedValueKey(Integer.class, of("ExpirationTicks"), "expiration_ticks"));
register(makeOptionalKey(Integer.class, of("ExplosionRadius"), "explosion_radius"));
register(makeValueKey(Boolean.class, of("Extended"), "extended"));
register(makeValueKey(Boolean.class, of("FallingBlockCanHurtEntities"), "falling_block_can_hurt_entities"));
register(makeValueKey(BlockState.class, of("FallingBlockState"), "falling_block_state"));
register(makeMutableBoundedValueKey(Double.class, of("FallDamagePerBlock"), "fall_damage_per_block"));
register(makeMutableBoundedValueKey(Float.class, of("FallDistance"), "fall_distance"));
register(makeValueKey(Integer.class, of("FallTime"), "fall_time"));
register(makeValueKey(Boolean.class, of("Filled"), "filled"));
register(makeListKey(FireworkEffect.class, of("FireworkEffects"), "firework_effects"));
register(makeMutableBoundedValueKey(Integer.class, of("FireworkFlightModifier"), "firework_flight_modifier"));
register(makeMutableBoundedValueKey(Integer.class, of("FireDamageDelay"), "fire_damage_delay"));
register(makeMutableBoundedValueKey(Integer.class, of("FireTicks"), "fire_ticks"));
register(makeValueKey(Instant.class, of("FirstDatePlayed"), "first_date_played"));
register(makeValueKey(Fish.class, of("FishType"), "fish_type"));
register(makeValueKey(FluidStackSnapshot.class, of("FluidItemStack"), "fluid_item_stack"));
register(makeMutableBoundedValueKey(Integer.class, of("FluidLevel"), "fluid_level"));
register(makeMapKeyWithKeyAndValue(Direction.class, List.class, of("FluidTankContents"), "fluid_tank_contents"));
register(makeValueKey(Double.class, of("FlyingSpeed"), "flying_speed"));
register(makeMutableBoundedValueKey(Integer.class, of("FoodLevel"), "food_level"));
register(makeValueKey(Integer.class, of("FuseDuration"), "fuse_duration"));
register(makeValueKey(GameMode.class, of("GameMode"), "game_mode"));
register(makeMutableBoundedValueKey(Integer.class, of("Generation"), "generation"));
register(makeValueKey(Boolean.class, of("Glowing"), "glowing"));
register(makeValueKey(GoldenApple.class, of("GoldenAppleType"), "golden_apple_type"));
register(makeMutableBoundedValueKey(Integer.class, of("GrowthStage"), "growth_stage"));
register(makeValueKey(Boolean.class, of("HasGravity"), "has_gravity"));
register(makeValueKey(Vector3d.class, of("HeadRotation"), "head_rotation"));
register(makeMutableBoundedValueKey(Double.class, of("Health"), "health"));
register(makeMutableBoundedValueKey(Double.class, of("HealthScale"), "health_scale"));
register(makeMutableBoundedValueKey(Float.class, of("Height"), "height"));
register(makeValueKey(Boolean.class, of("HideAttributes"), "hide_attributes"));
register(makeValueKey(Boolean.class, of("HideCanDestroy"), "hide_can_destroy"));
register(makeValueKey(Boolean.class, of("HideCanPlace"), "hide_can_place"));
register(makeValueKey(Boolean.class, of("HideEnchantments"), "hide_enchantments"));
register(makeValueKey(Boolean.class, of("HideMiscellaneous"), "hide_miscellaneous"));
register(makeValueKey(Boolean.class, of("HideUnbreakable"), "hide_unbreakable"));
register(makeValueKey(Hinge.class, of("HingePosition"), "hinge_position"));
register(makeValueKey(HorseColor.class, of("HorseColor"), "horse_color"));
register(makeValueKey(HorseStyle.class, of("HorseStyle"), "horse_style"));
register(makeValueKey(Boolean.class, of("InfiniteDespawnDelay"), "infinite_despawn_delay"));
register(makeValueKey(Boolean.class, of("InfinitePickupDelay"), "infinite_pickup_delay"));
register(makeValueKey(Boolean.class, of("InvisibilityIgnoresCollision"), "invisibility_ignores_collision"));
register(makeValueKey(Boolean.class, of("InvisibilityPreventsTargeting"), "invisibility_prevents_targeting"));
register(makeValueKey(Boolean.class, of("Invisible"), "invisible"));
register(makeMutableBoundedValueKey(Integer.class, of("InvulnerabilityTicks"), "invulnerability_ticks"));
register(makeValueKey(Boolean.class, of("Invulnerable"), "invulnerable"));
register(makeValueKey(Boolean.class, of("InWall"), "in_wall"));
register(makeValueKey(Boolean.class, of("IsAdult"), "is_adult"));
register(makeValueKey(Boolean.class, of("IsAflame"), "is_aflame"));
register(makeValueKey(Boolean.class, of("IsFlying"), "is_flying"));
register(makeValueKey(Boolean.class, of("IsJohnny"), "is_johnny"));
register(makeValueKey(Boolean.class, of("IsPlaying"), "is_playing"));
register(makeValueKey(Boolean.class, of("IsScreaming"), "is_screaming"));
register(makeValueKey(Boolean.class, of("IsSheared"), "is_sheared"));
register(makeValueKey(Boolean.class, of("IsSilent"), "is_silent"));
register(makeValueKey(Boolean.class, of("IsSitting"), "is_sitting"));
register(makeValueKey(Boolean.class, of("IsSleeping"), "is_sleeping"));
register(makeValueKey(Boolean.class, of("IsSneaking"), "is_sneaking"));
register(makeValueKey(Boolean.class, of("IsSprinting"), "is_sprinting"));
register(makeValueKey(Boolean.class, of("IsWet"), "is_wet"));
register(makeValueKey(BlockState.class, of("ItemBlockState"), "item_blockstate"));
register(makeMutableBoundedValueKey(Integer.class, of("ItemDurability"), "item_durability"));
register(makeListKey(Enchantment.class, of("ItemEnchantments"), "item_enchantments"));
register(makeListKey(Text.class, of("ItemLore"), "item_lore"));
register(makeValueKey(Boolean.class, of("JohnnyVindicator"), "johnny_vindicator"));
register(makeMutableBoundedValueKey(Integer.class, of("KnockbackStrength"), "knockback_strength"));
register(makeOptionalKey(EntitySnapshot.class, of("LastAttacker"), "last_attacker"));
register(makeOptionalKey(Text.class, of("LastCommandOutput"), "last_command_output"));
register(makeOptionalKey(Double.class, of("LastDamage"), "last_damage"));
register(makeValueKey(Instant.class, of("LastDatePlayed"), "last_date_played"));
register(makeValueKey(Integer.class, of("Layer"), "layer"));
register(makeValueKey(EntitySnapshot.class, of("LeashHolder"), "leash_holder"));
register(makeValueKey(Vector3d.class, of("LeftArmRotation"), "left_arm_rotation"));
register(makeValueKey(Vector3d.class, of("LeftLegRotation"), "left_leg_rotation"));
register(makeMutableBoundedValueKey(Integer.class, of("LlamaStrength"), "llama_strength"));
register(makeValueKey(LlamaVariant.class, of("LlamaVariant"), "llama_variant"));
register(makeValueKey(String.class, of("LockToken"), "lock_token"));
register(makeValueKey(LogAxis.class, of("LogAxis"), "log_axis"));
register(makeMutableBoundedValueKey(Integer.class, of("MaxAir"), "max_air"));
register(makeMutableBoundedValueKey(Integer.class, of("MaxBurnTime"), "max_burn_time"));
register(makeMutableBoundedValueKey(Integer.class, of("MaxCookTime"), "max_cook_time"));
register(makeMutableBoundedValueKey(Double.class, of("MaxFallDamage"), "max_fall_damage"));
register(makeMutableBoundedValueKey(Double.class, of("MaxHealth"), "max_health"));
register(makeMutableBoundedValueKey(Integer.class, of("Moisture"), "moisture"));
register(makeValueKey(NotePitch.class, of("NotePitch"), "note_pitch"));
register(makeValueKey(Boolean.class, of("Occupied"), "occupied"));
register(makeValueKey(OcelotType.class, of("OcelotType"), "ocelot_type"));
register(makeValueKey(Integer.class, of("Offset"), "offset"));
register(makeValueKey(Boolean.class, of("Open"), "open"));
register(makeMutableBoundedValueKey(Integer.class, of("PassedBurnTime"), "passed_burn_time"));
register(makeMutableBoundedValueKey(Integer.class, of("PassedCookTime"), "passed_cook_time"));
register(makeListKey(UUID.class, of("Passengers"), "passengers"));
register(makeValueKey(Boolean.class, of("Persists"), "persists"));
register(makeMutableBoundedValueKey(Integer.class, of("PickupDelay"), "pickup_delay"));
register(makeValueKey(PickupRule.class, of("PickupRule"), "pickup_rule"));
register(makeValueKey(Boolean.class, of("PigSaddle"), "pig_saddle"));
register(makeValueKey(PistonType.class, of("PistonType"), "piston_type"));
register(makeSetKey(BlockType.class, of("PlaceableBlocks"), "placeable_blocks"));
register(makeValueKey(PlantType.class, of("PlantType"), "plant_type"));
register(makeValueKey(Boolean.class, of("PlayerCreated"), "player_created"));
register(makeValueKey(PortionType.class, of("PortionType"), "portion_type"));
register(makeListKey(PotionEffect.class, of("PotionEffects"), "potion_effects"));
register(makeValueKey(Integer.class, of("Power"), "power"));
register(makeValueKey(Boolean.class, of("Powered"), "powered"));
register(makeValueKey(PrismarineType.class, of("PrismarineType"), "prismarine_type"));
register(makeValueKey(QuartzType.class, of("QuartzType"), "quartz_type"));
register(makeValueKey(RabbitType.class, of("RabbitType"), "rabbit_type"));
register(makeValueKey(RailDirection.class, of("RailDirection"), "rail_direction"));
register(makeMutableBoundedValueKey(Integer.class, of("RemainingAir"), "remaining_air"));
register(makeMutableBoundedValueKey(Integer.class, of("RemainingBrewTime"), "remaining_brew_time"));
register(makeValueKey(BlockState.class, of("RepresentedBlock"), "represented_block"));
register(makeValueKey(ItemStackSnapshot.class, of("RepresentedItem"), "represented_item"));
register(makeValueKey(GameProfile.class, of("RepresentedPlayer"), "represented_player"));
register(makeMapKeyWithKeyAndValue(UUID.class, RespawnLocation.class, of("RespawnLocations"), "respawn_locations"));
register(makeValueKey(Vector3d.class, of("RightArmRotation"), "right_arm_rotation"));
register(makeValueKey(Vector3d.class, of("RightLegRotation"), "right_leg_rotation"));
register(makeValueKey(Rotation.class, of("Rotation"), "rotation"));
register(makeValueKey(SandstoneType.class, of("SandstoneType"), "sandstone_type"));
register(makeValueKey(SandType.class, of("SandType"), "sand_type"));
register(makeMutableBoundedValueKey(Double.class, of("Saturation"), "saturation"));
register(makeMutableBoundedValueKey(Float.class, of("Scale"), "scale"));
register(makeValueKey(Boolean.class, of("Seamless"), "seamless"));
register(makeValueKey(Boolean.class, of("ShouldDrop"), "should_drop"));
register(makeValueKey(ShrubType.class, of("ShrubType"), "shrub_type"));
register(makeListKey(Text.class, of("SignLines"), "sign_lines"));
register(makeValueKey(UUID.class, of("SkinUniqueId"), "skin_unique_id"));
register(makeValueKey(SkullType.class, of("SkullType"), "skull_type"));
register(makeValueKey(SlabType.class, of("SlabType"), "slab_type"));
register(makeMutableBoundedValueKey(Integer.class, of("SlimeSize"), "slime_size"));
register(makeValueKey(Boolean.class, of("Snowed"), "snowed"));
register(makeValueKey(EntityType.class, of("SpawnableEntityType"), "spawnable_entity_type"));
register(makeWeightedCollectionKey(EntityArchetype.class, of("SpawnerEntities"), "spawner_entities"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerMaximumDelay"), "spawner_maximum_delay"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerMaximumNearbyEntities"), "spawner_maximum_nearby_entities"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerMinimumDelay"), "spawner_minimum_delay"));
register(makeValueKey(new TypeToken<WeightedSerializableObject<EntityArchetype>>() {
}, of("SpawnerNextEntityToSpawn"), "spawner_next_entity_to_spawn"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerRemainingDelay"), "spawner_remaining_delay"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerRequiredPlayerRange"), "spawner_required_player_range"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerSpawnCount"), "spawner_spawn_count"));
register(makeMutableBoundedValueKey(Short.class, of("SpawnerSpawnRange"), "spawner_spawn_range"));
register(makeValueKey(StairShape.class, of("StairShape"), "stair_shape"));
register(makeMapKeyWithKeyAndValue(Statistic.class, Long.class, of("Statistics"), "statistics"));
register(makeValueKey(StoneType.class, of("StoneType"), "stone_type"));
register(makeListKey(Enchantment.class, of("StoredEnchantments"), "stored_enchantments"));
register(makeValueKey(String.class, of("StructureAuthor"), "structure_author"));
register(makeValueKey(Boolean.class, of("StructureIgnoreEntities"), "structure_ignore_entities"));
register(makeValueKey(Float.class, of("StructureIntegrity"), "structure_integrity"));
register(makeValueKey(StructureMode.class, of("StructureMode"), "structure_mode"));
register(makeValueKey(Vector3i.class, of("StructurePosition"), "structure_position"));
register(makeValueKey(Boolean.class, of("StructurePowered"), "structure_powered"));
register(makeValueKey(Long.class, of("StructureSeed"), "structure_seed"));
register(makeValueKey(Boolean.class, of("StructureShowAir"), "structure_show_air"));
register(makeValueKey(Boolean.class, of("StructureShowBoundingBox"), "structure_show_bounding_box"));
register(makeValueKey(Vector3i.class, of("StructureSize"), "structure_size"));
register(makeMutableBoundedValueKey(Integer.class, of("StuckArrows"), "stuck_arrows"));
register(makeMutableBoundedValueKey(Integer.class, of("SuccessCount"), "success_count"));
register(makeValueKey(Boolean.class, of("Suspended"), "suspended"));
register(makeOptionalKey(UUID.class, of("TamedOwner"), "tamed_owner"));
register(makeValueKey(Vector3d.class, of("TargetedLocation"), "targeted_location"));
register(makeValueKey(Integer.class, of("TicksRemaining"), "ticks_remaining"));
register(makeMutableBoundedValueKey(Integer.class, of("TotalExperience"), "total_experience"));
register(makeValueKey(Boolean.class, of("TracksOutput"), "tracks_output"));
register(makeListKey(TradeOffer.class, of("TradeOffers"), "trade_offers"));
register(makeValueKey(TreeType.class, of("TreeType"), "tree_type"));
register(makeValueKey(Boolean.class, of("Unbreakable"), "unbreakable"));
register(makeValueKey(Boolean.class, of("Vanish"), "vanish"));
register(makeValueKey(Boolean.class, of("VanishIgnoresCollision"), "vanish_ignores_collision"));
register(makeValueKey(Boolean.class, of("VanishPreventsTargeting"), "vanish_prevents_targeting"));
register(makeValueKey(EntitySnapshot.class, of("Vehicle"), "vehicle"));
register(makeValueKey(Vector3d.class, of("Velocity"), "velocity"));
register(makeOptionalKey(Profession.class, of("VillagerZombieProfession"), "villager_zombie_profession"));
register(makeValueKey(Double.class, of("WalkingSpeed"), "walking_speed"));
register(makeValueKey(WallType.class, of("WallType"), "wall_type"));
register(makeValueKey(Boolean.class, of("WillShatter"), "will_shatter"));
register(makeMapKeyWithKeyAndValue(Direction.class, WireAttachmentType.class, of("WireAttachments"), "wire_attachments"));
register(makeValueKey(WireAttachmentType.class, of("WireAttachmentEast"), "wire_attachment_east"));
register(makeValueKey(WireAttachmentType.class, of("WireAttachmentNorth"), "wire_attachment_north"));
register(makeValueKey(WireAttachmentType.class, of("WireAttachmentSouth"), "wire_attachment_south"));
register(makeValueKey(WireAttachmentType.class, of("WireAttachmentWest"), "wire_attachment_west"));
causeStack.popCause();
causeStack.pushCause(Lantern.getImplementationPlugin());
// Register the lantern keys
for (Field field : LanternKeys.class.getFields()) {
if (Modifier.isStatic(field.getModifiers())) {
final Object object;
try {
object = field.get(null);
} catch (IllegalAccessException e) {
throw new RuntimeException(e);
}
if (object instanceof Key) {
register((Key) object);
}
}
}
causeStack.popCause();
}
use of org.spongepowered.api.data.type.PortionType in project LanternServer by LanternPowered.
the class SlabItemInteractionBehavior method tryInteract.
@Override
public BehaviorResult tryInteract(BehaviorPipeline<Behavior> pipeline, BehaviorContext context) {
final Optional<Location<World>> optLocation = context.getContext(ContextKeys.INTERACTION_LOCATION);
if (!optLocation.isPresent()) {
return BehaviorResult.CONTINUE;
}
final BlockType halfSlabType = this.halfSlabType.get();
final BlockType doubleSlabType = this.doubleSlabType.get();
Location<World> location = optLocation.get();
final Direction blockFace = context.getContext(ContextKeys.INTERACTION_FACE).get().getOpposite();
final LanternBlockType blockType = (LanternBlockType) context.getContext(ContextKeys.ITEM_TYPE).get().getBlock().get();
if (blockType != halfSlabType) {
return BehaviorResult.PASS;
}
BlockState state = location.getBlock();
final BlockState.Builder stateBuilder = BlockState.builder();
stateBuilder.blockType(blockType);
context.getContext(ContextKeys.USED_ITEM_STACK).ifPresent(itemStack -> itemStack.getValues().forEach(value -> stateBuilder.add((Key) value.getKey(), value.get())));
BlockState blockState = stateBuilder.build();
BlockSnapshotBuilder snapshotBuilder = null;
boolean success = false;
if (state.getType() == blockType) {
if (state.getTraitValue(this.variantTrait).get().equals(blockState.getTraitValue(this.variantTrait).get())) {
final PortionType portionType = state.getTraitValue(LanternEnumTraits.PORTION_TYPE).get();
if ((blockFace == Direction.DOWN && portionType == PortionTypes.BOTTOM) || (blockFace == Direction.UP && portionType == PortionTypes.TOP)) {
snapshotBuilder = BlockSnapshotBuilder.create().blockState(doubleSlabType.getDefaultState());
success = true;
}
}
} else if (location.getProperty(ReplaceableProperty.class).get().getValue()) {
success = true;
}
if (!success) {
location = location.add(blockFace.getOpposite().asBlockOffset());
state = location.getBlock();
if (state.getType() == blockType) {
if (state.getTraitValue(this.variantTrait).get().equals(blockState.getTraitValue(this.variantTrait).get())) {
final PortionType portionType = state.getTraitValue(LanternEnumTraits.PORTION_TYPE).get();
if ((blockFace == Direction.DOWN && portionType == PortionTypes.TOP) || (blockFace == Direction.UP && portionType == PortionTypes.BOTTOM)) {
snapshotBuilder = BlockSnapshotBuilder.create().blockState(doubleSlabType.getDefaultState());
success = true;
}
}
} else if (location.getProperty(ReplaceableProperty.class).get().getValue()) {
success = true;
}
}
if (success) {
if (snapshotBuilder == null) {
PortionType portionType;
if (blockFace == Direction.UP) {
portionType = PortionTypes.TOP;
} else if (blockFace == Direction.DOWN) {
portionType = PortionTypes.BOTTOM;
} else {
final double y = location.getY() - location.getBlockY();
if (y >= 0.5) {
portionType = PortionTypes.TOP;
} else {
portionType = PortionTypes.BOTTOM;
}
}
snapshotBuilder = BlockSnapshotBuilder.create().blockState(halfSlabType.getDefaultState()).add(Keys.PORTION_TYPE, portionType);
}
final BlockSnapshotBuilder snapshotBuilder1 = snapshotBuilder;
snapshotBuilder1.location(location);
context.getContext(ContextKeys.USED_ITEM_STACK).ifPresent(itemStack -> itemStack.getValues().forEach(value -> snapshotBuilder1.add((Key) value.getKey(), value.get())));
context.addBlockChange(snapshotBuilder1.build());
context.getContext(ContextKeys.PLAYER).ifPresent(player -> {
if (!player.get(Keys.GAME_MODE).orElse(GameModes.NOT_SET).equals(GameModes.CREATIVE)) {
context.requireContext(ContextKeys.USED_SLOT).poll(1);
}
});
return BehaviorResult.SUCCESS;
}
return BehaviorResult.FAIL;
}
use of org.spongepowered.api.data.type.PortionType in project LanternServer by LanternPowered.
the class LanternGameRegistry method registerDefaults.
public void registerDefaults() {
registerBuilderSupplier(LanternAttributeBuilder.class, LanternAttributeBuilder::new).registerBuilderSupplier(BlockSnapshot.Builder.class, LanternBlockSnapshotBuilder::new).registerBuilderSupplier(BlockSnapshotBuilder.class, LanternBlockSnapshotBuilder::new).registerBuilderSupplier(BlockState.Builder.class, LanternBlockStateBuilder::new).registerBuilderSupplier(WorldArchetype.Builder.class, LanternWorldArchetypeBuilder::new).registerBuilderSupplier(ParticleEffect.Builder.class, LanternParticleEffectBuilder::new).registerBuilderSupplier(PotionEffect.Builder.class, LanternPotionEffectBuilder::new).registerBuilderSupplier(Task.Builder.class, () -> new LanternTaskBuilder(Lantern.getGame().getScheduler())).registerBuilderSupplier(Ban.Builder.class, BanBuilder::new).registerBuilderSupplier(TabListEntry.Builder.class, LanternTabListEntryBuilder::new).registerBuilderSupplier(Selector.Builder.class, LanternSelectorBuilder::new).registerBuilderSupplier(Objective.Builder.class, LanternObjectiveBuilder::new).registerBuilderSupplier(Scoreboard.Builder.class, LanternScoreboardBuilder::new).registerBuilderSupplier(Team.Builder.class, LanternTeamBuilder::new).registerBuilderSupplier(ServerBossBar.Builder.class, LanternBossBarBuilder::new).registerBuilderSupplier(BlockDamageSource.Builder.class, LanternBlockDamageSourceBuilder::new).registerBuilderSupplier(DamageSource.Builder.class, LanternDamageSourceBuilder::new).registerBuilderSupplier(EntityDamageSource.Builder.class, LanternEntityDamageSourceBuilder::new).registerBuilderSupplier(FallingBlockDamageSource.Builder.class, LanternFallingBlockDamageSourceBuilder::new).registerBuilderSupplier(IndirectEntityDamageSource.Builder.class, LanternIndirectEntityDamageSourceBuilder::new).registerBuilderSupplier(HealingSource.Builder.class, LanternHealingSourceBuilder::new).registerBuilderSupplier(EntityHealingSource.Builder.class, LanternEntityHealingSourceBuilder::new).registerBuilderSupplier(RespawnLocation.Builder.class, RespawnLocation.Builder::new).registerBuilderSupplier(SoundType.Builder.class, LanternSoundTypeBuilder::new).registerBuilderSupplier(FireworkEffect.Builder.class, LanternFireworkEffectBuilder::new).registerBuilderSupplier(InventoryArchetype.Builder.class, LanternInventoryArchetypeBuilder::new).registerBuilderSupplier(Inventory.Builder.class, LanternInventoryBuilder::create).registerBuilderSupplier(BiomeGenerationSettings.Builder.class, LanternBiomeGenerationSettingsBuilder::new).registerBuilderSupplier(VirtualBiomeType.Builder.class, LanternVirtualBiomeTypeBuilder::new).registerBuilderSupplier(BlockStatisticBuilder.class, BlockStatisticBuilder::create).registerBuilderSupplier(EntityStatisticBuilder.class, EntityStatisticBuilder::create).registerBuilderSupplier(ItemStatisticBuilder.class, ItemStatisticBuilder::create).registerBuilderSupplier(StatisticBuilder.class, StatisticBuilder::create).registerBuilderSupplier(DataRegistration.Builder.class, LanternDataRegistrationBuilder::new).registerBuilderSupplier(WorldBorder.Builder.class, LanternWorldBorderBuilder::new).registerBuilderSupplier(FluidStack.Builder.class, LanternFluidStackBuilder::new).registerBuilderSupplier(FluidStackSnapshot.Builder.class, LanternFluidStackSnapshotBuilder::new).registerBuilderSupplier(ItemStack.Builder.class, LanternItemStackBuilder::new).registerBuilderSupplier(EventContextKey.Builder.class, LanternEventContextKeyBuilder::new).registerBuilderSupplier(Enchantment.Builder.class, LanternEnchantmentBuilder::new).registerBuilderSupplier(Key.Builder.class, LanternKeyBuilder::new).registerBuilderSupplier(Advancement.Builder.class, LanternAdvancementBuilder::new).registerBuilderSupplier(AdvancementTree.Builder.class, LanternAdvancementTreeBuilder::new).registerBuilderSupplier(AdvancementCriterion.Builder.class, LanternCriterionBuilder::new).registerBuilderSupplier(ScoreAdvancementCriterion.Builder.class, LanternScoreCriterionBuilder::new).registerBuilderSupplier(Trigger.Builder.class, LanternTriggerBuilder::new).registerBuilderSupplier(FilteredTrigger.Builder.class, LanternFilteredTriggerBuilder::new).registerBuilderSupplier(DisplayInfo.Builder.class, LanternDisplayInfoBuilder::new).registerBuilderSupplier(ShapedCraftingRecipe.Builder.class, LanternShapedCraftingRecipeBuilder::new).registerBuilderSupplier(IShapedCraftingRecipe.Builder.class, LanternShapedCraftingRecipeBuilder::new).registerBuilderSupplier(ShapelessCraftingRecipe.Builder.class, LanternShapelessCraftingRecipeBuilder::new).registerBuilderSupplier(IShapelessCraftingRecipe.Builder.class, LanternShapelessCraftingRecipeBuilder::new).registerBuilderSupplier(SmeltingRecipe.Builder.class, LanternSmeltingRecipeBuilder::new).registerBuilderSupplier(ISmeltingRecipe.Builder.class, LanternSmeltingRecipeBuilder::new).registerBuilderSupplier(Ingredient.Builder.class, LanternIngredientBuilder::new).registerBuilderSupplier(IIngredient.Builder.class, LanternIngredientBuilder::new).registerBuilderSupplier(IFuel.Builder.class, LanternFuelBuilder::new);
// All enum value enumerations must extend registry class, because very strange things
// are happening. Without this, all the dummy fields are never updated???
registerModule(LanternOperation.class, new AttributeOperationRegistryModule()).registerModule(LanternAttribute.class, new AttributeRegistryModule()).registerModule(new AttributeTargetRegistryModule()).registerModule(BlockType.class, BlockRegistryModule.get()).registerModule(BlockState.class, new BlockStateRegistryModule()).registerModule(BossBarColor.class, new BossBarColorRegistryModule()).registerModule(BossBarOverlay.class, new BossBarOverlayRegistryModule()).registerModule(Accessory.class, new AccessoryRegistryModule()).registerModule(DamageType.class, new DamageTypeRegistryModule()).registerModule(DamageModifierType.class, new DamageModifierTypeRegistryModule()).registerModule(new ConstantDamageSourceRegistryModule()).registerModule(HealingType.class, new HealingTypeRegistryModule()).registerModule(new ConstantHealingSourceRegistryModule()).registerModule(DismountType.class, new DismountTypeRegistryModule()).registerModule(SpawnType.class, new SpawnTypeRegistryModule()).registerModule(TeleportType.class, new TeleportTypeRegistryModule()).registerModule(DataFormat.class, new DataFormatRegistryModule()).registerModule(BigMushroomType.class, new EnumValueRegistryModule<BigMushroomType>(LanternBigMushroomType.class, BigMushroomTypes.class) {
}).registerModule(BrickType.class, new EnumValueRegistryModule<BrickType>(LanternBrickType.class, BrickTypes.class) {
}).registerModule(ComparatorType.class, new EnumValueRegistryModule<ComparatorType>(LanternComparatorType.class, ComparatorTypes.class) {
}).registerModule(DirtType.class, DirtTypeRegistryModule.get()).registerModule(DisguisedBlockType.class, new EnumValueRegistryModule<DisguisedBlockType>(LanternDisguisedBlockType.class, DisguisedBlockTypes.class) {
}).registerModule(LanternDoorHalf.class, new EnumValueRegistryModule<LanternDoorHalf>(LanternDoorHalf.class, null) {
}).registerModule(DoublePlantType.class, new EnumValueRegistryModule<DoublePlantType>(LanternDoublePlantType.class, DoublePlantTypes.class) {
}).registerModule(Art.class, new ArtRegistryModule()).registerModule(Career.class, new CareerRegistryModule()).registerModule(HandType.class, new HandTypeRegistryModule()).registerModule(HandPreference.class, new HandPreferenceRegistryModule()).registerModule(HorseColor.class, new HorseColorRegistryModule()).registerModule(HorseStyle.class, new HorseStyleRegistryModule()).registerModule(InstrumentType.class, new InstrumentTypeRegistryModule()).registerModule(Hinge.class, new EnumValueRegistryModule<Hinge>(LanternHinge.class, Hinges.class) {
}).registerModule(Key.class, KeyRegistryModule.get()).registerModule(PortionType.class, new EnumValueRegistryModule<PortionType>(LanternPortionType.class, PortionTypes.class) {
}).registerModule(LogAxis.class, new EnumValueRegistryModule<LogAxis>(LanternLogAxis.class, LogAxes.class) {
}).registerModule(NotePitch.class, NotePitchRegistryModule.get()).registerModule(OcelotType.class, new OcelotTypeRegistryModule()).registerModule(LlamaVariant.class, new LlamaVariantRegistryModule()).registerModule(Profession.class, new ProfessionRegistryModule()).registerModule(RabbitType.class, new RabbitTypeRegistryModule()).registerModule(ToolType.class, new ToolTypeRegistryModule()).registerModule(ArmorType.class, new ArmorTypeRegistryModule()).registerModule(PistonType.class, new EnumValueRegistryModule<PistonType>(LanternPistonType.class, PistonTypes.class) {
}).registerModule(PlantType.class, PlantTypeRegistryModule.get()).registerModule(PrismarineType.class, new EnumValueRegistryModule<PrismarineType>(LanternPrismarineType.class, PrismarineTypes.class) {
}).registerModule(QuartzType.class, QuartzTypeRegistryModule.get()).registerModule(SandstoneType.class, SandstoneTypeRegistryModule.get()).registerModule(SandType.class, SandTypeRegistryModule.get()).registerModule(ShrubType.class, ShrubTypeRegistryModule.get()).registerModule(StoneType.class, StoneTypeRegistryModule.get()).registerModule(SlabType.class, SlabTypeRegistryModule.get()).registerModule(TreeType.class, TreeTypeRegistryModule.get()).registerModule(WallType.class, new EnumValueRegistryModule<WallType>(LanternWallType.class, WallTypes.class) {
}).registerModule(SkinPart.class, new SkinPartRegistryModule()).registerModule(TransactionType.class, new TransactionTypeRegistryModule()).registerModule(ParticleType.class, new ParticleTypeRegistryModule()).registerModule(ParticleOption.class, new ParticleOptionRegistryModule()).registerModule(FireworkShape.class, FireworkShapeRegistryModule.get()).registerModule(PotionEffectType.class, PotionEffectTypeRegistryModule.get()).registerModule(SoundCategory.class, new SoundCategoryRegistryModule()).registerModule(SoundType.class, new SoundTypeRegistryModule()).registerModule(GameMode.class, GameModeRegistryModule.get()).registerModule(EquipmentType.class, new EquipmentTypeRegistryModule()).registerModule(ItemType.class, ItemRegistryModule.get()).registerModule(CollisionRule.class, new CollisionRuleRegistryModule()).registerModule(Criterion.class, new CriterionRegistryModule()).registerModule(DisplaySlot.class, new DisplaySlotRegistryModule()).registerModule(ObjectiveDisplayMode.class, new ObjectiveDisplayModeRegistryModule()).registerModule(Visibility.class, new VisibilityRegistryModule()).registerModule(new ArgumentTypeRegistryModule()).registerModule(ChatType.class, new ChatTypeRegistryModule()).registerModule(ChatVisibility.class, ChatVisibilityRegistryModule.get()).registerModule(new SelectorFactoryRegistryModule()).registerModule(SelectorType.class, new SelectorTypeRegistryModule()).registerModule(TextColor.class, new TextColorRegistryModule()).registerModule(new TextFormatRegistryModule()).registerModule(new TextSerializersRegistryModule()).registerModule(TextStyle.Base.class, new TextStyleRegistryModule()).registerModule(new TranslationManagerRegistryModule()).registerModule(BanType.class, new BanTypeRegistryModule()).registerModule(Rotation.class, new RotationRegistryModule()).registerModule(BiomeType.class, BiomeRegistryModule.get()).registerModule(new DefaultGameRulesRegistryModule()).registerModule(Difficulty.class, DifficultyRegistryModule.get()).registerModule(DimensionType.class, new DimensionTypeRegistryModule()).registerModule(WorldGeneratorModifier.class, new GeneratorModifierRegistryModule()).registerModule(GeneratorType.class, new GeneratorTypeRegistryModule()).registerModule(PortalAgentType.class, new PortalAgentTypeRegistryModule()).registerModule(SerializationBehavior.class, new SerializationBehaviorRegistryModule()).registerModule(Weather.class, new WeatherTypeRegistryModule()).registerModule(WorldArchetype.class, new WorldArchetypeRegistryModule()).registerModule(EntityType.class, EntityTypeRegistryModule.get()).registerModule(TileEntityType.class, TileEntityTypeRegistryModule.get()).registerModule(EntityProtocolType.class, new EntityProtocolTypeRegistryModule()).registerModule(InventoryArchetype.class, new InventoryArchetypeRegistryModule()).registerModule(QueryOperationType.class, new QueryOperationRegistryModule()).registerModule(GuiId.class, ClientContainerRegistryModule.get()).registerModule(GoldenApple.class, GoldenAppleRegistryModule.get()).registerModule(CoalType.class, CoalTypeRegistryModule.get()).registerModule(Fish.class, FishRegistryModule.get()).registerModule(CookedFish.class, CookedFishRegistryModule.get()).registerModule(DyeColor.class, DyeColorRegistryModule.get()).registerModule(PickupRule.class, PickupRuleRegistryModule.get()).registerModule(BannerPatternShape.class, BannerPatternShapeRegistryModule.get()).registerModule(EnchantmentType.class, EnchantmentTypeRegistryModule.get()).registerModule(SkullType.class, SkullTypeRegistryModule.get()).registerModule(PotionType.class, PotionTypeRegistryModule.get()).registerModule(RailDirection.class, RailDirectionRegistryModule.get()).registerModule(StatisticType.class, StatisticTypeRegistryModule.get()).registerModule(Statistic.class, StatisticRegistryModule.get()).registerModule(DataRegistration.class, DataManipulatorRegistryModule.get()).registerModule(RecordType.class, RecordTypeRegistryModule.get()).registerModule(FluidType.class, FluidTypeRegistryModule.get()).registerModule(EventContextKey.class, EventContextKeysModule.get()).registerModule(new BlockChangeFlagRegistryModule()).registerModule(new ItemStackComparatorRegistryModule()).registerModule(AdvancementTree.class, AdvancementTreeRegistryModule.get()).registerModule(Advancement.class, AdvancementRegistryModule.get()).registerModule(AdvancementType.class, new AdvancementTypeRegistryModule()).registerModule(Trigger.class, TriggerRegistryModule.get()).registerModule(new AdvancementTreeLayoutModule()).registerModule(new AdvancementCriterionModule()).registerModule(CraftingRecipe.class, this.craftingRecipeRegistry.getRegistryModule()).registerModule(ISmeltingRecipe.class, this.smeltingRecipeRegistry.getRegistryModule()).registerModule(IFuel.class, this.fuelRegistryModule).registerModule(Parameter.class, new ContextParameterRegistryModule()).registerModule(ActionType.class, ActionTypeRegistryModule.get()).registerModule(ConditionType.class, ConditionTypeRegistryModule.get()).registerModule(DoubleValueProviderType.class, DoubleValueProviderTypeRegistryModule.get()).registerModule(FloatValueProviderType.class, FloatValueProviderTypeRegistryModule.get()).registerModule(IntValueProviderType.class, IntValueProviderTypeRegistryModule.get());
registerFactories();
}
Aggregations