Builtin config adapters
This page contains examples (and extra documentation where needed) for every ConfigAdapter bundled with Rebar.
Primitive adapters
ConfigAdapter.BYTE
Range: -128 to 127
ConfigAdapter.SHORT
Range: -32768 to 32767
ConfigAdapter.INTEGER
Range: -2147483648 and 2147483647
ConfigAdapter.LONG
Range: -9223372036854775808 and 9223372036854775807
ConfigAdapter.FLOAT
| example-1: 5
example-2: 5.2
|
ConfigAdapter.DOUBLE
| example-1: 5
example-2: 5.2
|
ConfigAdapter.INT_RANGE
| example-1: [3, 8]
example-2:
min: 3
max: 8
example-3: 5 # 5 <= x <= 5
|
ConfigAdapter.BOOLEAN
ConfigAdapter.CHAR
| example-1: 'h'
example-2: "h"
|
ConfigAdapter.STRING
ConfigAdapter.ANY
A special config adapter which returns the raw type returned by ConfigurationSection#get.
You should basically never need to use this.
Miscellaneous adapters
ConfigAdapter.CONFIG_SECTION
| example:
some-key: 5
some-other-key: 10
|
ConfigAdapter.UUID
| example-1: "b48e7ff7-4c0f-4234-869b-69b6db1d4c57"
exmaple-2: [-8747281617155961769, -5436267000079891916]
|
ConfigAdapter.NAMESPACED_KEY
ConfigAdapter.MATERIAL
| example-1: red_wool
example-2: Red_wOoL
|
ConfigAdapter.BLOCK_DATA
| example: minecraft:chest[waterlogged=true]
|
ConfigAdapter.TEXT_COLOR
Can be any of the following:
- A hex color code
- A color name (see NamedTextColor for a list of available colors)
- An RGB color (r, g, and b are from 0-255)
- A HSV color (h, s, and v are from 0.0-1.0)
| example-1: "#5a45f3"
example-2: gold
example-3: liGHt_pURPLe
example-4:
r: 200
g: 155
b: 30
example-5:
h: 0.83
s: 0.76
v: 0.28
|
ConfigAdapter.ITEM_TAG
See the Minecraft wiki for a list of available item tags.
| example: "#glazed_terracotta"
|
ConfigAdapter.SOUND
| example:
sound: minecraft:block.anvil.use
source: player
volume: 0.5
pitch: 1.0
|
ConfigAdapter.RANDOMIZED_SOUND
See RandomizedSound.
| example:
hammer-sound:
sounds:
- minecraft:block.anvil.use
- minecraft:block.anvil.land
source: player
volume:
min: 0.3
max: 0.7
pitch:
- 0.8
- 1.2
|
ConfigAdapter.WAILA_DISPLAY
| example:
text: ""
color: white
overlay: progress
progress: 1.0
|
ConfigAdapter.CULLING_PRESET
| example:
index: 1
id: "low"
material: "minecraft:green_concrete"
update-interval: 1
hidden-interval: 1
visible-interval: 10
always-show-radius: 48
cull-radius: 128
max-occluding-count: 5
|
ConfigAdapter.CONTRIBUTOR
| example:
display-name: "Watermelon"
description: "<white><!i>Hey girl, are you a kettle? Because I'm 90% water."
minecraft-uuid: "bb685dd0-8a71-4506-bc20-24d374fb28b4"
github: "WatermelonMC"
|
Collection adapters
ConfigAdapter.LIST
| # All examples read using ConfigAdapter.LIST.from(ConfigAdapter.INTEGER)
example-1:
- 5
- 7
example-2: [5, 7]
example-3: []
|
ConfigAdapter.SET
Same format as ConfigAdapter.LIST. Duplicate values do not cause errors, and only appear once in the resulting map.
| # All examples read using ConfigAdapter.SET.from(ConfigAdapter.INTEGER)
example-1:
- 5
- 7
example-2: [5, 7]
example-3: []
|
ConfigAdapter.MAP
If there are any duplicated keys, an error will be thrown.
| # Read using ConfigAdapter.MAP.from(ConfigAdapter.INTEGER, ConfigAdapter.STRING)
example-1:
5: "wat"
9: "erm"
66: "elon"
# Read using:
# ConfigAdapter.MAP.from(
# ConfigAdapter.LIST.from(ConfigAdapter.INTEGER),
# ConfigAdapter.STRING)
# );
example-2:
- key: [2, 6]
value: "wat"
- key: [7, 9, 3]
value: "erm"
- key: []
value: "elon"
|
ConfigAdapter.WEIGHTED_SET
See WeightedSet for more info.
| example:
- value: "watermelon"
weight: 5
- value: "cantaloupe"
weight: 3
- value: "honeydew melon"
weight: 8
|
Vector adapters
ConfigAdapter.VECTOR_2I
ConfigAdapter.VECTOR_2F
| example-1: [2.6, 1.3]
example-2: [1.0, 6]
|
ConfigAdapter.VECTOR_2D
| example-1: [2.6, 1.3]
example-2: [1.0, 6]
|
ConfigAdapter.VECTOR_3I
ConfigAdapter.VECTOR_3F
| example-1: [2.6, 1.3, 6.4]
example-2: [1.0, 6, 6.4]
|
ConfigAdapter.VECTOR_3D
| example-1: [2.6, 1.3, 6.4]
example-2: [1.0, 6, 6.4]
|
Generic adapters
ConfigAdapter.ENUM
A ConfigAdapter which represents an enum. You can specify which enum to use by calling ConfigAdapter.ENUM.from(<enum class>). Case insensitive.
| # Read with ConfigAdapter.ENUM.from(Material.class)
example-1: diamond_pickaxe
# Read with ConfigAdapter.ENUM.from(MiningLevel.class)
example-2: gold
|
ConfigAdapter.KEYED
A ConfigAdapter which reads from any set of things associated with a key, such as materials, Rebar items, etc.
Usually created from a Rebar registry via ConfigAdapter.KEYED.fromRegistry, but you can also create one by passing in your own function to turn keys into values with ConfigAdapter.KEYED.fromGetter.
| # Read with ConfigAdapter.KEYED.fromRegistry(RebarItemSchema.class, RebarRegistry.ITEMS)
example: pylon:fluid_pipe_copper
|
Fluid/Item adapters
ConfigAdapter.ITEM_STACK
| example-1: stick
example-2: minecraft:stick
example-3:
stick: 5
example-4: potion[potion_contents={potion:"healing"}]
example-5:
'potion[potion_contents={potion:"healing"}]': 7
|
ConfigAdapter.ITEM_TYPE_WRAPPER
| example-1: pylon:fluid_pipe_copper
example-2: minecraft:apple
|
ConfigAdapter.ITEM_CHOICE
Amount defaults to one if unspecified.
If exact is set, the choice will require all the components to be their default value. For example, if exact is set and the item is renamed, it will no longer match the recipe choice. You can specify components to omit in this check using ignore.
| example-1: "#minecraft:acacia_logs"
example-2: 'minecraft:potion[potion_contents={potion:"healing"}]'
example-3: minecraft:apple
example-4: pylon:copper_dust
example-5:
'#minecraft:acacia_logs': 5
example-6:
choices:
- pylon:bronze_pickaxe
- "#minecraft:pickaxes"
example-7:
amount: 5
choices:
- item: pylon:bronze_pickaxe
exact: true
ignore:
- damage
- item: pylon:bronze_ingot
- item: minecraft:stone_pickaxe
|
ConfigAdapter.REBAR_FLUID
ConfigAdapter.FLUID_TEMPERATURE
ConfigAdapter.FLUID_CHOICE
| example-1:
pylon:water: 100
example-2:
pylon:water: 333.333333333
example-3:
fluids: [pylon:water, pylon:lava]
amount: 300
|
ConfigAdapter.FLUID_OR_ITEM
Accepts anything that ConfigAdapter.ITEM_STACK or ConfigAdapter.FLUID_WITH_AMOUNT accept.
| example-1: potion[potion_contents={potion:"healing"}]
example-2:
pylon:copper_dust: 5
example-3: minecraft:apple
example-4:
pylon:water: 100
example-5:
pylon:water: 333.333333333
|
ConfigAdapter.FLUID_WITH_AMOUNT
| example-1:
pylon:water: 100
example-2:
pylon:water: 333.333333333
|