Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
275 commits
Select commit Hold shift + click to select a range
04fe043
Add priority option to definitions, deprecate texture size and render…
eclipseisoffline Dec 12, 2024
5ecc61f
Implement priority option
eclipseisoffline Dec 12, 2024
12499bf
Read priority option from mappings
eclipseisoffline Dec 12, 2024
bca98c7
Add unbreakable condition predicate
eclipseisoffline Dec 12, 2024
6e0e3c0
Use unbreakable predicate when converting v1 to v2 mappings
eclipseisoffline Dec 12, 2024
774e556
Remove BedrockCreativeTab in favour of CreativeCategory
eclipseisoffline Dec 12, 2024
1685918
Remove adventure from API module
eclipseisoffline Dec 12, 2024
7164ca0
Some fixes
eclipseisoffline Dec 12, 2024
2263cc8
Remove this
eclipseisoffline Dec 12, 2024
3fac2cd
Reimplement unbreakable predicate check
eclipseisoffline Dec 12, 2024
361df16
Fix build
eclipseisoffline Dec 12, 2024
b80c054
Fix charge type predicate
eclipseisoffline Dec 12, 2024
eb0b40c
I'm very confused at why this doesn't work
eclipseisoffline Dec 12, 2024
a4c17da
Fix adding multiple definitions for same item model and sorting of pr…
eclipseisoffline Dec 12, 2024
a80e90d
Fix adding multiple definitions for same item model again
eclipseisoffline Dec 12, 2024
e7d7a9d
Improve mapping custom items
eclipseisoffline Dec 14, 2024
12f2e1a
Improve the reading and error handling of item mappings
eclipseisoffline Dec 16, 2024
fe8336a
Some of Adventure was left in the API
eclipseisoffline Dec 16, 2024
f44f368
Improve predicate reading error handling
eclipseisoffline Dec 16, 2024
a997820
Make item definitions in group able to override the group's model
eclipseisoffline Dec 16, 2024
7ed830a
Improve error handling when registering custom items
eclipseisoffline Dec 16, 2024
b5cef99
Clean up custom item registry populator a bit
eclipseisoffline Dec 16, 2024
66e288f
Improve documentation of (predicate) new API
eclipseisoffline Dec 16, 2024
852c5c2
Apparently Javadoc can break builds
eclipseisoffline Dec 16, 2024
18cde32
Improve documentation just a bit
eclipseisoffline Dec 16, 2024
885c4d9
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Dec 16, 2024
25109b7
Add predicate caching
eclipseisoffline Dec 19, 2024
635c8c4
Default to definition type when no type key is given
eclipseisoffline Dec 19, 2024
e84f8a3
Whoops got to include the lib
eclipseisoffline Dec 19, 2024
bcc7915
Factor in range dispatch scaling when sorting predicate
eclipseisoffline Dec 19, 2024
4aea17a
Component combination validation
eclipseisoffline Dec 19, 2024
1683243
Fix max stack size validation when reading json mappings
eclipseisoffline Dec 19, 2024
4629f7b
"Implement" v2 block mappings reading
eclipseisoffline Dec 19, 2024
2b9f519
Cleanup item registry populator a bit
eclipseisoffline Dec 19, 2024
ff35c6e
Fix mapping reading
eclipseisoffline Dec 19, 2024
b254594
Move identifierToKey out of ItemRegistryPopulator
eclipseisoffline Dec 19, 2024
56c508d
Throw UnsupportedOperationException when reading block v2 mappings
eclipseisoffline Dec 19, 2024
5620f0a
Move predicate implementations out of API module
eclipseisoffline Jan 10, 2025
0986203
Send nutrition and saturation to the client
eclipseisoffline Jan 10, 2025
e8bd2a1
Refactor mappings reading with proper type checking and conversions a…
eclipseisoffline Jan 10, 2025
aa365d9
Small cleanup
eclipseisoffline Jan 10, 2025
aa13113
Clean up predicates in the API
eclipseisoffline Jan 10, 2025
094ff41
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jan 10, 2025
7af9518
Implement predicate strategies
eclipseisoffline Jan 10, 2025
f4c9c3d
Read predicate strategies from mappings
eclipseisoffline Jan 10, 2025
46e6fd3
Remove MCPL from API module, but now stuff is broken. Also still need…
eclipseisoffline Jan 11, 2025
03402d4
Update implementations and mappings reader, but populator is broken
eclipseisoffline Jan 11, 2025
aabd537
My IDE did something it shouldn't have
eclipseisoffline Jan 11, 2025
d06ad0b
Improve enum reader error message
eclipseisoffline Jan 11, 2025
1dce683
Move predicate classes up
eclipseisoffline Jan 11, 2025
7e973ea
Fix component patching, MCPL removal is done now
eclipseisoffline Jan 11, 2025
9f21221
Component validation in the API
eclipseisoffline Jan 11, 2025
ffb94ff
Proper support for the enchantable value property
eclipseisoffline Jan 13, 2025
44a1bba
Reformat some stuff my IDE shouldn't have done
eclipseisoffline Jan 13, 2025
33b49eb
Properly implement protection value
eclipseisoffline Jan 13, 2025
0e5dba1
Documentation improvements, add converter for enchantable component
eclipseisoffline Jan 13, 2025
0308388
Remove unused stuff
eclipseisoffline Jan 13, 2025
d522f61
Remove rarely used method
eclipseisoffline Jan 13, 2025
61b703c
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jan 13, 2025
ebbd1c5
Small documentation stuff
eclipseisoffline Jan 13, 2025
1afb733
Work on tool component stuff
eclipseisoffline Jan 14, 2025
75e371c
Add tool component to API
eclipseisoffline Jan 14, 2025
67b615e
Implement tool component in custom item populator
eclipseisoffline Jan 14, 2025
261b6ca
Add tool component mappings reader
eclipseisoffline Jan 14, 2025
c63386a
Update documentation
eclipseisoffline Jan 14, 2025
2558620
Add repairable mappings reader
eclipseisoffline Jan 14, 2025
373eeac
Implement repairable component in custom item registry populator
eclipseisoffline Jan 14, 2025
fbbf210
Documentation whoopsy
eclipseisoffline Jan 14, 2025
ab174b5
Javadoc broke my build again (this isn't proper HTML)
eclipseisoffline Jan 14, 2025
422c5a9
Update MCPL
eclipseisoffline Jan 17, 2025
a5d6fb1
Consistency renames, start on has component predicate
eclipseisoffline Jan 17, 2025
af76cd0
Update API module with has component predicate
eclipseisoffline Jan 17, 2025
505a74b
Update implementations and implement has component predicate
eclipseisoffline Jan 18, 2025
dee7b5a
Update reading of match predicate property
eclipseisoffline Jan 18, 2025
6705513
Fix broken/damaged predicates
eclipseisoffline Jan 18, 2025
bd7e471
Remove enchantable stuff from chargeable properties as that is decide…
eclipseisoffline Jan 18, 2025
ea850f4
Clean up custom item registry populator
eclipseisoffline Jan 18, 2025
020e78e
Make new item definition register method throw exception
eclipseisoffline Jan 18, 2025
27b2ec7
Charge type javadocs
eclipseisoffline Jan 18, 2025
fc0103b
Make air model constant
eclipseisoffline Jan 18, 2025
2662c81
Rename creative category internal name to bedrock name
eclipseisoffline Jan 18, 2025
6f67814
Make sure deprecated getExistingCustomItems method still functions
eclipseisoffline Jan 18, 2025
c1bd5fa
Data component map javadoc
eclipseisoffline Jan 18, 2025
99b01ee
Apply suggestions from code review
eclipseisoffline Jan 18, 2025
b2776a3
Forgot one
eclipseisoffline Jan 18, 2025
5ac8a24
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jan 18, 2025
ec9e9fc
I messed up the merge conflicts, whoops
eclipseisoffline Jan 18, 2025
d22e815
Work on component javadoc
eclipseisoffline Jan 18, 2025
4b7ef99
Some fixes
eclipseisoffline Jan 19, 2025
a0b785c
Whoops
eclipseisoffline Jan 19, 2025
92d3296
Work on changing mappings reader to Gson
eclipseisoffline Jan 19, 2025
af371b1
Update data component readers to use Gson
eclipseisoffline Jan 19, 2025
2c9596d
Mappings reader gson part 1
eclipseisoffline Jan 19, 2025
4095f89
Mappings reader gson part 2
eclipseisoffline Jan 19, 2025
a7fbcc6
Mappings reader gson part 3
eclipseisoffline Jan 19, 2025
0ae556c
Whoops almost removed v2 mappings
eclipseisoffline Jan 19, 2025
3fff601
Some fixes and stuff
eclipseisoffline Jan 19, 2025
de95eb5
Bye bye render offsets
eclipseisoffline Jan 19, 2025
215c309
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Feb 11, 2025
97a2e99
More small fixes
eclipseisoffline Feb 11, 2025
dac6d53
Rename getExistingCustomItemDefinitions to customItemDefinitions in d…
eclipseisoffline Feb 15, 2025
3c388a7
Use API Identifiers to represent vanilla items instead of strings
eclipseisoffline Feb 15, 2025
2558ca6
Add javadocs to CustomItemDefinitionRegisterException
eclipseisoffline Feb 15, 2025
292efc6
Switch tags to identifiers
eclipseisoffline Feb 15, 2025
b3d7747
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Feb 15, 2025
ac5c391
Switch Identifier constructors to short .of call
eclipseisoffline Feb 15, 2025
1b4fc15
Change Identifier in API to interface
eclipseisoffline Feb 15, 2025
085bb6e
Add tag(Identifier) method to bedrock options builder
eclipseisoffline Feb 15, 2025
22d7ef9
Add new creative categories
eclipseisoffline Feb 15, 2025
e709e64
Work on making predicates in API abstract
eclipseisoffline Feb 16, 2025
07cd54d
Implement predicate changes in geyser, range predicates still broken
eclipseisoffline Feb 16, 2025
5131a3d
Write javadocs for new predicate stuff in the API
eclipseisoffline Feb 16, 2025
6a8e70c
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Feb 22, 2025
4b3e671
Fix the build™
eclipseisoffline Feb 22, 2025
a882d7f
Merge branch 'custom-item-api-v2' into api-predicates
eclipseisoffline Feb 22, 2025
573ace1
Fix the build™ v2.0: now for the fancy predicate API
eclipseisoffline Feb 22, 2025
5bcd9d9
Lazy initialise the stuff in predicate context
eclipseisoffline Feb 22, 2025
a433b91
Move item predicate context
eclipseisoffline Feb 22, 2025
4adbccb
Work on fishing_rod/cast predicate
eclipseisoffline Feb 23, 2025
d5bbccf
Work on range-dispatch predicates in the new predicate API
eclipseisoffline Mar 9, 2025
f2b1b7b
Improve some javadocs
eclipseisoffline Mar 9, 2025
81fefb9
Write more javadocs
eclipseisoffline Mar 9, 2025
7cde240
Re-implement reading range dispatch predicates from JSON mappings
eclipseisoffline Mar 9, 2025
bb2f758
Cleanup ItemMatchProperty a bit
eclipseisoffline Mar 9, 2025
6bb5575
Write some TODOs
eclipseisoffline Mar 9, 2025
4c9676e
Some fixes and docs
eclipseisoffline Mar 10, 2025
a4a1222
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Mar 10, 2025
17fa9e3
Start working on non-vanilla custom items v2
eclipseisoffline Mar 11, 2025
63a9f8e
Implement the stuff in Geyser
eclipseisoffline Mar 11, 2025
2a3ca59
Update the define custom items event
eclipseisoffline Mar 14, 2025
33ba15d
More progress with non-vanilla custom items
eclipseisoffline Mar 14, 2025
f3db517
Implement NonVanillaCustomItemData -> definition conversion
eclipseisoffline Mar 14, 2025
c91db0c
Fix v1 mappings using the vanilla item identifier as bedrock identifier
eclipseisoffline Mar 17, 2025
109474c
Add chargeable geyser data component
eclipseisoffline Mar 17, 2025
c183b8e
Implement chargeable data component in geyser
eclipseisoffline Mar 17, 2025
ffc0481
Convert old chargeable property to new component, don't allow chargea…
eclipseisoffline Mar 17, 2025
e0c228f
Remove chargeable method from NonVanillaCustomItemDefinition, work on…
eclipseisoffline Mar 17, 2025
0efee85
Implement attack damage component
eclipseisoffline Mar 17, 2025
366d8b6
Add and implement block placer component
eclipseisoffline Mar 17, 2025
a9021d1
Update documentation
eclipseisoffline Mar 17, 2025
1dfb6c5
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Mar 17, 2025
6bf2d0f
Write some more documentation
eclipseisoffline Mar 17, 2025
bfbca7b
Some TODOs and stuff
eclipseisoffline Mar 17, 2025
5a64c65
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Mar 26, 2025
826e2f3
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Mar 29, 2025
306c3ea
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Apr 6, 2025
6218884
Reintroduce player place null check in BlockPlaceMixin
eclipseisoffline Apr 7, 2025
c510204
Merge branch 'block-item-mixin-fix' into custom-item-api-v2
eclipseisoffline Apr 7, 2025
dd9cc61
Make it build
eclipseisoffline Apr 8, 2025
1b0d3f6
Support new equipment slots
eclipseisoffline Apr 8, 2025
8641196
Introduce component converter for tool component and use in custom it…
eclipseisoffline Apr 8, 2025
ab9d645
Merge branch 'custom-item-api-v2' into api-predicates
eclipseisoffline Apr 20, 2025
9fcc8eb
Random stuff to make it build
eclipseisoffline Apr 20, 2025
cfdde40
Some cleanups
eclipseisoffline Apr 20, 2025
d84856e
Predicate conflict detection is back, sort of, by using a bunch of re…
eclipseisoffline Apr 20, 2025
1eb4caa
Add back fishing rod cast predicate
eclipseisoffline Apr 22, 2025
9df0a35
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline May 6, 2025
dcff4ec
Implement removing of default vanilla item components
eclipseisoffline May 5, 2025
baed6cf
Fix the build
eclipseisoffline May 6, 2025
4e55579
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline May 9, 2025
d004a13
Allow 0 values for max draw duration in chargeable component
eclipseisoffline May 9, 2025
aa3e0bd
Fix applying component removals to custom items
eclipseisoffline May 11, 2025
2a2738b
Allow overriding vanilla models if the model is not used by the vanil…
eclipseisoffline May 11, 2025
d5a1f22
Some small changes
eclipseisoffline May 13, 2025
7887ba9
Some more small changes
eclipseisoffline May 13, 2025
9dafa6c
Merge branch 'custom-item-api-v2' into api-predicates
eclipseisoffline May 13, 2025
78a2aa4
Range dispatch predicate sorting and comments/documentation
eclipseisoffline May 13, 2025
90c883d
More javadocs
eclipseisoffline May 13, 2025
da6f859
Merge pull request #2 from eclipseisoffline/api-predicates
eclipseisoffline May 13, 2025
17bfcf9
Some more comments
eclipseisoffline May 13, 2025
45a6a7e
Add back enchantment glint override component
eclipseisoffline May 13, 2025
1ce84cd
Add enchantment_glint_override component reader
eclipseisoffline May 16, 2025
1e3ce1e
Give custom items a breaking speed of 1
eclipseisoffline May 16, 2025
4eab395
Add useBlockIcon property
eclipseisoffline May 17, 2025
b035ae2
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline May 17, 2025
9b6be61
Some clarifying comments
eclipseisoffline May 17, 2025
6ddad6d
Allow null values for cooldown group in use cooldown component
eclipseisoffline May 19, 2025
c28ee88
I worked on this in 2025 too
eclipseisoffline May 19, 2025
33f4247
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jun 17, 2025
2f41ae9
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jun 17, 2025
9638f82
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jun 26, 2025
5a85f52
Let it build
eclipseisoffline Jun 26, 2025
6d25f4f
Use the right mappings
eclipseisoffline Jun 26, 2025
f9a4467
Component Javadocs and interfaces (#3)
onebeastchris Jun 29, 2025
1d234d9
Start on extended tool properties component, API is done
eclipseisoffline Jun 29, 2025
c587673
Work on resolvable components/session based components
eclipseisoffline Jun 29, 2025
49a303f
Create CustomItemContext record
eclipseisoffline Jun 29, 2025
bdc9279
Fix build, actually create resolvable tool properties component
eclipseisoffline Jun 29, 2025
a2ab1bb
Make it run
eclipseisoffline Jun 29, 2025
7fec9df
Register Holders builder API
eclipseisoffline Jun 29, 2025
f764bed
Only store ComponentCache for item stacks, debug statements
eclipseisoffline Jun 29, 2025
e0fd201
Fix build
eclipseisoffline Jun 29, 2025
d2db5af
Null-safety for component cache
eclipseisoffline Jul 1, 2025
94ddb38
Fix looking up block IDs by key
eclipseisoffline Jul 1, 2025
502396b
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jul 1, 2025
69d93ff
Javadocs and minor API changes
eclipseisoffline Jul 1, 2025
eeaf827
Proper Repairable component
eclipseisoffline Jul 1, 2025
b622ad1
Fix repairable reader
eclipseisoffline Jul 1, 2025
4e23bab
Move v2 JSON mapping reader logic out of MappingsReader_v2 and into s…
eclipseisoffline Jul 2, 2025
0d5305a
Implement legacy definitions
eclipseisoffline Jul 2, 2025
550c1d4
Fix custom item definition sorting and legacy definition reading
eclipseisoffline Jul 2, 2025
32b245e
Allow passing JSON text component as display name
eclipseisoffline Jul 2, 2025
185265a
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
eclipseisoffline Jul 3, 2025
d3a3029
First batch of Javadoc reviews
eclipseisoffline Jul 5, 2025
ef9ffbc
Address more reviews, and some other things
eclipseisoffline Jul 5, 2025
a4ebc3a
More reviews addressed
eclipseisoffline Jul 12, 2025
04e6dd1
Fix: creative item groups/categories (#8)
eclipseisoffline Jul 14, 2025
5ead237
interfacing of predicates (#7)
onebeastchris Jul 14, 2025
69efa63
Simplify some component converters
eclipseisoffline Jul 15, 2025
8a3f9e5
Check non-vanilla item network ID for conflicts in API event call
eclipseisoffline Jul 15, 2025
1c67220
Clarify enchantable component Javadocs
eclipseisoffline Jul 15, 2025
45685ca
Clarify and test consumable animation behaviour
eclipseisoffline Jul 15, 2025
35a37b0
Translation string javadocs
eclipseisoffline Jul 15, 2025
4c03da3
Fix custom trident mappings not having an animation in 3rd-person (#6)
eclipseisoffline Jul 15, 2025
90fa346
Add throwable, projectile, entity placer components to the API
eclipseisoffline Jul 15, 2025
7df5470
Address reviews
eclipseisoffline Jul 16, 2025
7761c87
Merge branch 'master' into custom-item-api-v2
onebeastchris Jul 18, 2025
7ee920e
Little things
eclipseisoffline Jul 18, 2025
704ab1e
Fix the build
eclipseisoffline Jul 18, 2025
ce3f260
Merge branch 'master' into custom-item-api-v2
onebeastchris Jul 27, 2025
e77b2c3
Merge branch 'master' into custom-item-api-v2
eclipseisoffline Jul 31, 2025
28b9a75
Merge branch 'master' into custom-item-api-v2
eclipseisoffline Aug 5, 2025
65b5d98
Merge branch 'master' into custom-item-api-v2
onebeastchris Aug 17, 2025
716ba95
Merge branch 'master' into custom-item-api-v2
eclipseisoffline Sep 11, 2025
f7cd72e
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
onebeastchris Sep 30, 2025
35296aa
Fix: right clicking for custom items
onebeastchris Oct 1, 2025
59b3cb4
Merge branch 'master' into custom-item-api-v2
onebeastchris Oct 8, 2025
f06991f
Merge remote-tracking branch 'upstream/master' into fork/eclipseisoff…
onebeastchris Oct 11, 2025
efb79fe
Merge branch 'master' into custom-item-api-v2
onebeastchris Oct 12, 2025
5d419ba
Merge branch 'master' into custom-item-api-v2
eclipseisoffline Oct 24, 2025
28b3a84
Account for non-vanilla item definitions in block breaking.
oryxel1 Oct 27, 2025
96b19ed
Fix: creative category registration without a creative item group spe…
onebeastchris Oct 27, 2025
1870078
Use IntSet instead of List.
oryxel1 Oct 28, 2025
03cc0e9
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
onebeastchris Oct 28, 2025
e8b88d3
Merge remote-tracking branch 'upstream/master' into custom-item-api-v2
onebeastchris Nov 18, 2025
9443333
Merge branch 'master' into custom-item-api-v2
onebeastchris Nov 21, 2025
a2eda21
Merge branch 'master' into custom-item-api-v2
onebeastchris Dec 9, 2025
1684354
Merge branch 'master' into custom-item-api-v2
onebeastchris Dec 10, 2025
14ed398
Merge branch 'master' into custom-item-api-v2
Kas-tle Dec 13, 2025
bc69219
New components API definitions/interfaces, still needs documentation
eclipseisoffline Dec 14, 2025
c010c13
Write implementations for new components
eclipseisoffline Dec 14, 2025
5583f67
Implement new components in custom item registry populator
eclipseisoffline Dec 16, 2025
2cdb54d
Implement new component readers
eclipseisoffline Dec 16, 2025
4a4379f
Simplify registering data component readers
eclipseisoffline Dec 16, 2025
edf26ea
Write documentation in the API for new components, remove some unnece…
eclipseisoffline Dec 16, 2025
8cb82b4
Merge branch 'master' into custom-item-api-v2
eclipseisoffline Dec 18, 2025
7d2079e
Merge branch 'master' into custom-item-api-v2
onebeastchris Dec 27, 2025
400eae5
Write component converters for 1.21.11 MCPL components and use them i…
eclipseisoffline Dec 29, 2025
aa944ec
Custom item registry populator cleanups, only send new context on 1.2…
eclipseisoffline Dec 29, 2025
789abab
Fix trident use animation
eclipseisoffline Dec 29, 2025
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
1 change: 1 addition & 0 deletions api/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ plugins {
dependencies {
api(libs.base.api)
api(libs.math)
api(libs.jetbrains.annotations)
}

version = property("version")!!
Expand Down
2 changes: 2 additions & 0 deletions api/src/main/java/org/geysermc/geyser/api/GeyserApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.geysermc.geyser.api.network.RemoteServer;
import org.geysermc.geyser.api.util.MinecraftVersion;
import org.geysermc.geyser.api.util.PlatformType;
import org.jetbrains.annotations.ApiStatus;

import java.nio.file.Path;
import java.util.List;
Expand All @@ -47,6 +48,7 @@
/**
* Represents the API used in Geyser.
*/
@ApiStatus.NonExtendable
public interface GeyserApi extends GeyserApiBase {
/**
* {@inheritDoc}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,13 @@

import org.checkerframework.checker.nullness.qual.NonNull;
import org.geysermc.event.Event;
import org.geysermc.geyser.api.item.custom.v2.CustomItemDefinitionRegisterException;
import org.geysermc.geyser.api.item.custom.CustomItemData;
import org.geysermc.geyser.api.item.custom.NonVanillaCustomItemData;
import org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition;
import org.geysermc.geyser.api.item.custom.v2.NonVanillaCustomItemDefinition;
import org.geysermc.geyser.api.util.Identifier;
import org.jetbrains.annotations.ApiStatus;

import java.util.Collection;
import java.util.List;
Expand All @@ -37,40 +42,86 @@
/**
* Called on Geyser's startup when looking for custom items. Custom items must be registered through this event.
* <p>
* This event will not be called if the "add non-Bedrock items" setting is disabled in the Geyser config.
* This event will not be called if the "add-non-bedrock-items" setting is disabled in the Geyser config.
*/
@ApiStatus.NonExtendable
public interface GeyserDefineCustomItemsEvent extends Event {

/**
* Gets a multimap of all the already registered custom items indexed by the item's extended java item's identifier.
* A multimap of all the already registered custom items indexed by the item's extended java item's identifier.
* The map returned here will only contain items registered with the deprecated
* {@link GeyserDefineCustomItemsEvent#register(String, CustomItemData)} method.
*
* @return a multimap of all the already registered custom items
* @deprecated replaced by {@link GeyserDefineCustomItemsEvent#customItemDefinitions()}
*/
@Deprecated
@NonNull
Map<String, Collection<CustomItemData>> getExistingCustomItems();

/**
* Gets the list of the already registered non-vanilla custom items.
* A multimap of all the already registered custom item definitions
* indexed by the {@link Identifier} of the Java item which the item is based on.
*/
@NonNull
Map<Identifier, Collection<CustomItemDefinition>> customItemDefinitions();

/**
* A list of the already registered non-vanilla custom items.
* The map returned here will only contain items registered with the deprecated
* {@link GeyserDefineCustomItemsEvent#register(NonVanillaCustomItemData)} method.
*
* @return the list of the already registered non-vanilla custom items
* @deprecated replaced by {@link GeyserDefineCustomItemsEvent#nonVanillaCustomItemDefinitions()}
*/
@Deprecated
@NonNull
List<NonVanillaCustomItemData> getExistingNonVanillaCustomItems();

/**
* A multimap of all the already registered non-vanilla custom item definitions indexed by the non-vanilla Java item {@link Identifier} these are mapped to.
*
* <p>This multimap will, at the moment, always have one entry per key.</p>
*/
@NonNull
Map<Identifier, Collection<NonVanillaCustomItemDefinition>> nonVanillaCustomItemDefinitions();

/**
* Registers a custom item with a base Java item. This is used to register items with custom textures and properties
* based on NBT data.
* based on NBT data. This method should not be used anymore, {@link CustomItemDefinition}s are preferred now and this method will convert {@link CustomItemData} to {@link CustomItemDefinition} internally.
*
* @param identifier the base (java) item
* @param customItemData the custom item data to register
* @return if the item was registered
* @deprecated use {@link GeyserDefineCustomItemsEvent#register(Identifier, CustomItemDefinition)}
*/
@Deprecated
boolean register(@NonNull String identifier, @NonNull CustomItemData customItemData);

/**
* Registers a Bedrock custom item definition based on a Java item. This is used to register items with custom textures and properties
* created using item data component patches.
*
* @param identifier of the Java edition base item
* @param customItemDefinition the custom item definition to register
* @throws CustomItemDefinitionRegisterException when an error occurred while registering the item
*/
void register(@NonNull Identifier identifier, @NonNull CustomItemDefinition customItemDefinition);

/**
* Registers a custom item with no base item. This is used for mods.
* This method should not be used anymore, {@link NonVanillaCustomItemDefinition}s are preferred now and this method will convert {@link NonVanillaCustomItemData} to {@link NonVanillaCustomItemDefinition} internally.
*
* @param customItemData the custom item data to register
* @return if the item was registered
* @deprecated use {@link GeyserDefineCustomItemsEvent#register(NonVanillaCustomItemDefinition)}
*/
@Deprecated
boolean register(@NonNull NonVanillaCustomItemData customItemData);
}

/**
* Registers a custom item with no base Java edition item. This is used for non-vanilla items added by mods.
*
* @param customItemDefinition the custom item definition to register
* @throws CustomItemDefinitionRegisterException when an error occurred while registering the item
*/
void register(@NonNull NonVanillaCustomItemDefinition customItemDefinition);
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@

/**
* This is used to store data for a custom item.
*
* @deprecated use the new {@link org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition}
*/
@Deprecated
public interface CustomItemData {
/**
* Gets the item's name.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@

/**
* This class represents the different ways you can register custom items
*
* @deprecated use the new {@link org.geysermc.geyser.api.item.custom.v2.CustomItemDefinition}.
*/
@Deprecated
public interface CustomItemOptions {
/**
* Gets if the item should be unbreakable.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@

/**
* Represents a completely custom item that is not based on an existing vanilla Minecraft item.
*
* @deprecated use the new {@link org.geysermc.geyser.api.item.custom.v2.NonVanillaCustomItemDefinition}
*/
@Deprecated
public interface NonVanillaCustomItemData extends CustomItemData {
/**
* Gets the java identifier for this item.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
/*
* Copyright (c) 2024 GeyserMC. http://geysermc.org
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
* @author GeyserMC
* @link https://github.com/GeyserMC/Geyser
*/

package org.geysermc.geyser.api.item.custom.v2;

import org.checkerframework.checker.nullness.qual.NonNull;
import org.checkerframework.checker.nullness.qual.Nullable;
import org.checkerframework.common.returnsreceiver.qual.This;
import org.geysermc.geyser.api.GeyserApi;
import org.geysermc.geyser.api.util.CreativeCategory;
import org.geysermc.geyser.api.util.Identifier;

import java.util.Set;

/**
* This is used to store options for a custom item definition that can't be described using item components.
*/
public interface CustomItemBedrockOptions {

/**
* Gets the item's icon. When not present, the item's Bedrock identifier is used.
*
* @return the item's icon
* @see CustomItemDefinition#icon()
*/
@Nullable
String icon();

/**
* If the item is allowed to be put into the offhand. Defaults to true.
*
* @return true if the item is allowed to be used in the offhand, false otherwise
*/
boolean allowOffhand();

/**
* If the item should be displayed as handheld, like a tool. Defaults to false.
*
* @return true if the item should be displayed as handheld, false otherwise
*/
boolean displayHandheld();

/**
* Since Bedrock doesn't properly support setting item armour values over attributes, this value
* determines how many armour points should be shown when this item is worn. This is purely visual.
*
* <p>Only has an effect when the item is equippable, and defaults to 0.</p>
*
* @return the item's protection value. Purely visual and for Bedrock only.
*/
int protectionValue();

/**
* The item's creative category. Defaults to {@code NONE}.
*
* @return the item's creative category
*/
@NonNull
CreativeCategory creativeCategory();

/**
* The item's creative group.
*
* <p>A list of creative groups available in vanilla can be found <a href="https://wiki.bedrock.dev/documentation/menu-categories#list-of-vanilla-groups">here</a>.</p>
*
* @return the item's creative group
*/
@Nullable
String creativeGroup();

/**
* Gets the item's set of bedrock tags that can be used in Molang.
* Equivalent to "tag:some_tag"
*
* @return the item's set of bedrock tags, can be empty
*/
@NonNull
Set<Identifier> tags();

/**
* Creates a new builder for custom item bedrock options.
*
* @return a new builder
*/
static Builder builder() {
return GeyserApi.api().provider(Builder.class);
}

/**
* Builder for custom item bedrock options.
*/
interface Builder {

/**
* Sets the item's icon.
*
* @param icon the item's icon
* @see CustomItemBedrockOptions#icon()
* @return this builder
*/
@This
Builder icon(@Nullable String icon);

/**
* Sets if the item is allowed to be put into the offhand.
*
* @param allowOffhand if the item is allowed to be put into the offhand slot
* @see CustomItemBedrockOptions#allowOffhand()
* @return this builder
*/
@This
Builder allowOffhand(boolean allowOffhand);

/**
* Sets if the item should be displayed as handheld, like a tool.
*
* @param displayHandheld if the item should be displayed as handheld
* @see CustomItemBedrockOptions#displayHandheld()
* @return this builder
*/
@This
Builder displayHandheld(boolean displayHandheld);

/**
* Sets the item's protection value.
*
* @param protectionValue the item's protection value
* @see CustomItemBedrockOptions#protectionValue()
* @return this builder
*/
@This
Builder protectionValue(int protectionValue);

/**
* Sets the item's creative category.
*
* @param creativeCategory the item's creative category
* @see CustomItemBedrockOptions#creativeCategory()
* @return this builder
*/
@This
Builder creativeCategory(@NonNull CreativeCategory creativeCategory);

/**
* Sets the item's creative group.
*
* @param creativeGroup the item's creative group
* @see CustomItemBedrockOptions#creativeGroup()
* @return this builder
*/
@This
Builder creativeGroup(@Nullable String creativeGroup);

/**
* Adds a tag to the set of bedrock tags this item has, for use in Molang.
*
* @param tag the tag to be added
* @see CustomItemBedrockOptions#tags()
* @return this builder
*/
@This
Builder tag(@NonNull Identifier tag);

/**
* Sets the item's set of bedrock tags, for use in Molang. Pass {@code null} to clear all tags.
*
* @param tags the tags to be set, or {@code null} to clear all tags
* @return this builder
*/
@This
Builder tags(@Nullable Set<Identifier> tags);

/**
* Creates the custom item bedrock options.
*
* @return the new instance of bedrock options
*/
CustomItemBedrockOptions build();
}
}
Loading