mirror of
https://github.com/GeyserMC/Geyser.git
synced 2024-08-14 23:57:35 +00:00
Add ability to set molang tags for custom items (#4041)
* Start on custom molang tags with custom items * geyser_custom instead of geyser item tag * Address reviews, add custom namespace ("geyser_custom") to tags * use isBlank() instead of isEmpty() * More efficient item tag setting Co-authored-by: Konicai <71294714+konicai@users.noreply.github.com> * tags instead of temp * Merge in master, adapt to changes in the MappingsReader, delete unused ToolBreakSpeedsUtils class * oops * clean diff * Change namespace from `geyser_custom` to just `geyser` * Don't force a namespace at all; just like blocks don't * Tags for items are now, as blocks, NonNull. Additionally, calling the .tags() builder multiple times will not add both sets of tags, but replace the existing tag set * Remove @NotNull usage in favor of @NonNull * Allow setting null for tags, but ensure that .tags() is always non-null * Fix nullable annotation on tags method in the builder interface
This commit is contained in:
parent
aa899af908
commit
f40ca2004e
9 changed files with 85 additions and 191 deletions
|
@ -185,7 +185,7 @@ public interface CustomBlockComponents {
|
|||
|
||||
Builder placeAir(boolean placeAir);
|
||||
|
||||
Builder tags(Set<String> tags);
|
||||
Builder tags(@Nullable Set<String> tags);
|
||||
|
||||
CustomBlockComponents build();
|
||||
}
|
||||
|
|
|
@ -29,6 +29,8 @@ import org.checkerframework.checker.nullness.qual.NonNull;
|
|||
import org.checkerframework.checker.nullness.qual.Nullable;
|
||||
import org.geysermc.geyser.api.GeyserApi;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* This is used to store data for a custom item.
|
||||
*/
|
||||
|
@ -89,6 +91,14 @@ public interface CustomItemData {
|
|||
*/
|
||||
@Nullable CustomRenderOffsets renderOffsets();
|
||||
|
||||
/**
|
||||
* Gets the item's set of tags that can be used in Molang.
|
||||
* Equivalent to "tag:some_tag"
|
||||
*
|
||||
* @return the item's tags, if they exist
|
||||
*/
|
||||
@NonNull Set<String> tags();
|
||||
|
||||
static CustomItemData.Builder builder() {
|
||||
return GeyserApi.api().provider(CustomItemData.Builder.class);
|
||||
}
|
||||
|
@ -113,6 +123,8 @@ public interface CustomItemData {
|
|||
|
||||
Builder renderOffsets(@Nullable CustomRenderOffsets renderOffsets);
|
||||
|
||||
Builder tags(@Nullable Set<String> tags);
|
||||
|
||||
CustomItemData build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -239,6 +239,9 @@ public interface NonVanillaCustomItemData extends CustomItemData {
|
|||
@Override
|
||||
Builder renderOffsets(@Nullable CustomRenderOffsets renderOffsets);
|
||||
|
||||
@Override
|
||||
Builder tags(@Nullable Set<String> tags);
|
||||
|
||||
NonVanillaCustomItemData build();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue