-
-
Notifications
You must be signed in to change notification settings - Fork 341
Add item groups (aka creative tabs) #1866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1edebb7
e3ceb87
4d9c5b2
02771f8
47a7995
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| /* | ||
| * This file is part of SpongeAPI, licensed under the MIT License (MIT). | ||
| * | ||
| * Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
| * Copyright (c) contributors | ||
| * | ||
| * 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. | ||
| */ | ||
| package org.spongepowered.api.item; | ||
|
|
||
| import org.spongepowered.api.CatalogType; | ||
| import org.spongepowered.api.text.translation.Translatable; | ||
| import org.spongepowered.api.util.annotation.CatalogedBy; | ||
|
|
||
| /** | ||
| * Represents an item group, or creative tab. | ||
| * | ||
| * <p>Item groups are signified by where they show on clients and otherwise have | ||
| * little usable functionality.</p> | ||
| */ | ||
| @CatalogedBy(ItemGroups.class) | ||
| public interface ItemGroup extends CatalogType, Translatable { | ||
|
|
||
| default boolean contains(ItemType itemType) { | ||
| return itemType.getItemGroups().contains(this); | ||
| } | ||
|
|
||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| /* | ||
| * This file is part of SpongeAPI, licensed under the MIT License (MIT). | ||
| * | ||
| * Copyright (c) SpongePowered <https://www.spongepowered.org> | ||
| * Copyright (c) contributors | ||
| * | ||
| * 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. | ||
| */ | ||
| package org.spongepowered.api.item; | ||
|
|
||
| import org.spongepowered.api.util.generator.dummy.DummyObjectProvider; | ||
|
|
||
| /** | ||
| * An enumeration of the known vanilla {@link ItemGroup}s in Minecraft. | ||
| * Mods may change and/or introduce new groups at runtime. | ||
| */ | ||
| public final class ItemGroups { | ||
|
|
||
| // SORTFIELDS:ON | ||
|
|
||
| public static final ItemGroup BREWING = DummyObjectProvider.createFor(ItemGroup.class, "BREWING"); | ||
|
|
||
| public static final ItemGroup BUILDING_BLOCKS = DummyObjectProvider.createFor(ItemGroup.class, "BUILDING_BLOCKS"); | ||
|
|
||
| public static final ItemGroup COMBAT = DummyObjectProvider.createFor(ItemGroup.class, "COMBAT"); | ||
|
|
||
| public static final ItemGroup DECORATIONS = DummyObjectProvider.createFor(ItemGroup.class, "DECORATIONS"); | ||
|
|
||
| public static final ItemGroup FOOD = DummyObjectProvider.createFor(ItemGroup.class, "FOOD"); | ||
|
|
||
| public static final ItemGroup MATERIALS = DummyObjectProvider.createFor(ItemGroup.class, "MATERIALS"); | ||
|
|
||
| public static final ItemGroup MISC = DummyObjectProvider.createFor(ItemGroup.class, "MISC"); | ||
|
|
||
| public static final ItemGroup REDSTONE = DummyObjectProvider.createFor(ItemGroup.class, "REDSTONE"); | ||
|
|
||
| public static final ItemGroup TOOLS = DummyObjectProvider.createFor(ItemGroup.class, "TOOLS"); | ||
|
|
||
| public static final ItemGroup TRANSPORTATION = DummyObjectProvider.createFor(ItemGroup.class, "TRANSPORTATION"); | ||
|
|
||
| // SORTFIELDS:OFF | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You missed the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes,
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are you attempting to expose the tab itself, for say, GUI click events. Or are you attempting to expose the property of items to belong to a creative tab?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, just exposing the property of items to belong to an item group. |
||
|
|
||
| // Suppress default constructor to ensure non-instantiability. | ||
| private ItemGroups() { | ||
| throw new AssertionError("You should not be attempting to instantiate this class."); | ||
| } | ||
|
|
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How would this compare to being used? They're just signified by where they show on clients? There's otherwise no other usable functionality to gain from this, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should document by answering these questions in some sense. That will fill out the javadoc for this class.