From 22d2bfc11857e1f7faa424766cd4c5b4919849de Mon Sep 17 00:00:00 2001 From: Dmitry Luk Date: Sun, 23 Jun 2024 01:43:26 +0500 Subject: [PATCH] docs: translate all JavaDocs in API module * refactor: Enchantment compatibilities & add rarity * fix: Enchantments rarity * refactor: Do not use short on enchantments * refactor: API module --- .../main/java/org/allaymc/api/AllayAPI.java | 26 +- .../allaymc/api/annotation/SlowOperation.java | 3 +- .../component/common/BlockAttributes.java | 4 +- .../component/common/BlockBaseComponent.java | 13 +- .../component/common/PlayerInteractInfo.java | 6 +- .../component/event/BlockOnInteractEvent.java | 4 - .../event/BlockOnNeighborUpdateEvent.java | 2 - .../allaymc/api/block/material/Material.java | 6 +- .../api/block/material/MaterialType.java | 1 - .../block/palette/BlockStateHashPalette.java | 5 +- .../api/block/property/PropertyUtil.java | 2 + .../api/block/property/enums/Attachment.java | 14 +- .../block/property/enums/BambooLeafSize.java | 12 +- .../property/enums/BambooStalkThickness.java | 10 +- .../block/property/enums/BigDripleafTilt.java | 14 +- .../block/property/enums/CauldronLiquid.java | 12 +- .../property/enums/ChemistryTableType.java | 14 +- .../api/block/property/enums/ChiselType.java | 14 +- .../api/block/property/enums/CoralColor.java | 19 -- .../block/property/enums/CrackedState.java | 12 +- .../api/block/property/enums/Damage.java | 14 +- .../api/block/property/enums/DirtType.java | 10 +- .../block/property/enums/DoublePlantType.java | 21 -- .../property/enums/DripstoneThickness.java | 16 +- .../api/block/property/enums/FlowerType.java | 31 -- .../block/property/enums/LeverDirection.java | 22 +- .../property/enums/MinecraftBlockFace.java | 18 +- .../enums/MinecraftCardinalDirection.java | 14 +- .../enums/MinecraftFacingDirection.java | 18 +- .../property/enums/MinecraftVerticalHalf.java | 10 +- .../property/enums/MonsterEggStoneType.java | 18 +- .../api/block/property/enums/Orientation.java | 30 +- .../api/block/property/enums/PillarAxis.java | 12 +- .../api/block/property/enums/PortalAxis.java | 12 +- .../property/enums/PrismarineBlockType.java | 12 +- .../block/property/enums/SandStoneType.java | 14 +- .../api/block/property/enums/SandType.java | 10 +- .../api/block/property/enums/SaplingType.java | 21 -- .../block/property/enums/SeaGrassType.java | 12 +- .../api/block/property/enums/SpongeType.java | 10 +- .../block/property/enums/StoneBrickType.java | 16 +- .../block/property/enums/StoneSlabType.java | 22 +- .../block/property/enums/StoneSlabType2.java | 22 +- .../block/property/enums/StoneSlabType3.java | 22 +- .../block/property/enums/StoneSlabType4.java | 16 +- .../property/enums/StructureBlockType.java | 18 +- .../property/enums/StructureVoidType.java | 10 +- .../block/property/enums/TallGrassType.java | 17 - .../property/enums/TorchFacingDirection.java | 18 +- .../block/property/enums/TurtleEggCount.java | 14 +- .../api/block/property/enums/VaultState.java | 14 +- .../block/property/enums/WallBlockType.java | 34 +- .../enums/WallConnectionTypeEast.java | 12 +- .../enums/WallConnectionTypeNorth.java | 12 +- .../enums/WallConnectionTypeSouth.java | 12 +- .../enums/WallConnectionTypeWest.java | 12 +- .../property/type/BaseBlockPropertyType.java | 26 +- .../property/type/BlockPropertyType.java | 7 +- .../property/type/BooleanPropertyType.java | 11 +- .../block/property/type/EnumPropertyType.java | 10 +- .../block/property/type/IntPropertyType.java | 15 +- .../api/blockentity/BlockEntityHelper.java | 4 +- .../init/SimpleBlockEntityInitInfo.java | 8 +- .../interfaces/BlockEntityBarrel.java | 1 - .../allaymc/api/client/data/Abilities.java | 20 +- .../api/client/data/AdventureSettings.java | 2 +- .../org/allaymc/api/client/data/Device.java | 7 +- .../allaymc/api/client/data/DeviceInfo.java | 28 +- .../allaymc/api/client/data/LoginData.java | 3 +- .../allaymc/api/client/data/UIProfile.java | 2 - .../org/allaymc/api/client/skin/Image.java | 1 - .../allaymc/api/client/skin/PersonaPiece.java | 9 +- .../api/client/skin/PersonaPieceTint.java | 1 - .../org/allaymc/api/client/skin/Skin.java | 12 +- .../api/client/skin/SkinAnimation.java | 1 - .../allaymc/api/command/CommandRegistry.java | 6 +- .../allaymc/api/command/CommandSender.java | 31 +- .../allaymc/api/command/NPCCommandSender.java | 1 + .../org/allaymc/api/command/SenderType.java | 1 - .../exception/CommandParseException.java | 3 - .../command/selector/EntitySelectorAPI.java | 22 +- .../selector/SelectorSyntaxException.java | 6 +- .../api/command/selector/SelectorType.java | 15 +- .../args/CachedFilterSelectorArgument.java | 14 +- .../args/CachedSimpleSelectorArgument.java | 17 +- .../selector/args/SelectorArgument.java | 79 +++-- .../allaymc/api/command/tree/BaseNode.java | 14 +- .../allaymc/api/command/tree/CommandNode.java | 8 +- .../api/component/annotation/Dependency.java | 12 +- .../api/component/interfaces/Component.java | 11 +- .../interfaces/ComponentInitInfo.java | 3 +- .../interfaces/ComponentInjector.java | 11 +- .../interfaces/ComponentProvider.java | 5 +- .../interfaces/ComponentedObject.java | 5 +- .../impl/PlayerInventoryContainer.java | 1 - .../api/data/VanillaBlockPropertyTypes.java | 314 ++++++++---------- .../allaymc/api/datastruct/SemVersion.java | 1 - .../aabbtree/AABBOverlapFilter.java | 1 - .../api/datastruct/aabbtree/AABBTree.java | 30 +- .../api/datastruct/aabbtree/AABBTreeNode.java | 58 +--- .../datastruct/aabbtree/AABBTreeObject.java | 11 +- .../api/datastruct/aabbtree/AABBUtils.java | 13 +- .../aabbtree/AreaAABBHeuristicFunction.java | 10 +- .../datastruct/aabbtree/CollisionPair.java | 2 +- .../api/datastruct/aabbtree/HasAABB.java | 1 - .../org/allaymc/api/entity/EntityHelper.java | 4 +- .../api/entity/attribute/AttributeType.java | 22 +- .../component/common/EntityBaseComponent.java | 44 +-- .../component/event/EntityDieEvent.java | 4 - .../component/event/PlayerLoggedInEvent.java | 1 - .../player/EntityPlayerBaseComponent.java | 10 +- .../api/entity/damage/DamageContainer.java | 6 +- .../entity/effect/SimpleEffectInstance.java | 2 +- .../effect/type/EffectAbsorptionType.java | 1 - .../allaymc/api/entity/metadata/Metadata.java | 4 +- .../allaymc/api/eventbus/EventException.java | 3 - .../org/allaymc/api/eventbus/event/Event.java | 6 +- .../org/allaymc/api/form/FormException.java | 3 - .../api/form/element/CustomFormElement.java | 4 +- .../allaymc/api/form/element/Dropdown.java | 1 + .../org/allaymc/api/form/element/Input.java | 1 + .../org/allaymc/api/form/element/Label.java | 1 + .../org/allaymc/api/form/element/Slider.java | 1 + .../allaymc/api/form/element/StepSlider.java | 1 + .../org/allaymc/api/form/element/Toggle.java | 1 + .../org/allaymc/api/form/type/CustomForm.java | 1 + .../java/org/allaymc/api/form/type/Form.java | 1 + .../org/allaymc/api/form/type/ModalForm.java | 8 +- .../org/allaymc/api/form/type/SimpleForm.java | 5 +- .../main/java/org/allaymc/api/i18n/I18n.java | 2 +- .../java/org/allaymc/api/i18n/LangCode.java | 8 +- .../java/org/allaymc/api/item/ItemHelper.java | 23 +- .../java/org/allaymc/api/item/ItemTier.java | 11 +- .../component/common/ItemBaseComponent.java | 12 +- .../descriptor/ComplexAliasDescriptor.java | 2 +- .../item/descriptor/DefaultDescriptor.java | 4 +- .../descriptor/ItemDescriptorWithCount.java | 2 +- .../item/descriptor/ItemTagDescriptor.java | 2 +- .../enchantment/AbstractEnchantmentType.java | 46 +-- .../item/enchantment/EnchantmentHelper.java | 4 +- .../item/enchantment/EnchantmentInstance.java | 8 +- .../item/enchantment/EnchantmentRegistry.java | 2 +- .../api/item/enchantment/EnchantmentType.java | 11 +- .../allaymc/api/item/enchantment/Rarity.java | 16 +- .../SimpleEnchantmentInstance.java | 22 +- .../type/EnchantmentBaneOfArthropodsType.java | 9 + .../type/EnchantmentBlastProtectionType.java | 8 + .../type/EnchantmentBreachType.java | 12 +- .../type/EnchantmentChannelingType.java | 6 + .../type/EnchantmentDensityType.java | 12 +- .../type/EnchantmentDepthStriderType.java | 6 + .../type/EnchantmentFireProtectionType.java | 8 + .../type/EnchantmentFortuneType.java | 6 + .../type/EnchantmentFrostWalkerType.java | 6 + .../type/EnchantmentInfinityType.java | 6 + .../type/EnchantmentLoyaltyType.java | 6 + .../type/EnchantmentMendingType.java | 6 + .../type/EnchantmentMultishotType.java | 6 + .../type/EnchantmentPiercingType.java | 6 + .../EnchantmentProjectileProtectionType.java | 8 + .../type/EnchantmentProtectionType.java | 8 + .../type/EnchantmentRiptideType.java | 6 + .../type/EnchantmentSharpnessType.java | 6 + .../type/EnchantmentSilkTouchType.java | 6 + .../type/EnchantmentSmiteType.java | 9 + .../type/EnchantmentWindBurstType.java | 4 +- .../api/item/recipe/CraftingRecipe.java | 43 +-- .../api/item/recipe/IdentifiedRecipe.java | 2 +- .../api/item/recipe/NetworkRecipe.java | 2 +- .../org/allaymc/api/item/recipe/Recipe.java | 6 +- .../allaymc/api/item/recipe/ShapedRecipe.java | 124 ++++--- .../api/item/recipe/ShapelessRecipe.java | 37 +-- .../allaymc/api/item/recipe/TaggedRecipe.java | 3 +- .../allaymc/api/item/recipe/UniqueRecipe.java | 5 +- .../api/item/recipe/input/CraftingInput.java | 2 +- .../api/math/voxelshape/CommonShapes.java | 9 +- .../api/math/voxelshape/VoxelShape.java | 69 ++-- .../org/allaymc/api/network/ProtocolInfo.java | 5 +- .../org/allaymc/api/pack/PackManifest.java | 8 +- .../java/org/allaymc/api/perm/PermKeys.java | 1 + .../org/allaymc/api/perm/Permissible.java | 4 +- .../org/allaymc/api/perm/tree/PermTree.java | 11 +- .../allaymc/api/plugin/PluginContainer.java | 3 +- .../allaymc/api/registry/MappedRegistry.java | 9 +- .../api/registry/SimpleBiMappedRegistry.java | 2 +- .../SimpleDoubleKeyMappedRegistry.java | 2 +- .../api/registry/SimpleMappedRegistry.java | 2 +- .../allaymc/api/registry/SimpleRegistry.java | 2 +- .../org/allaymc/api/scheduler/Scheduler.java | 3 - .../allaymc/api/scheduler/TaskCreator.java | 5 +- .../allaymc/api/scoreboard/Scoreboard.java | 171 +++++----- .../api/scoreboard/ScoreboardLine.java | 44 ++- .../api/scoreboard/ScoreboardService.java | 30 +- .../api/scoreboard/ScoreboardViewer.java | 33 +- .../api/scoreboard/data/DisplaySlot.java | 24 +- .../api/scoreboard/data/SortOrder.java | 8 +- .../api/scoreboard/scorer/EntityScorer.java | 16 +- .../api/scoreboard/scorer/FakeScorer.java | 8 +- .../api/scoreboard/scorer/PlayerScorer.java | 33 +- .../allaymc/api/scoreboard/scorer/Scorer.java | 23 +- .../storage/JsonScoreboardStorage.java | 27 +- .../scoreboard/storage/ScoreboardStorage.java | 2 - .../java/org/allaymc/api/server/Server.java | 23 +- .../allaymc/api/server/ServerSettings.java | 6 +- .../java/org/allaymc/api/world/Dimension.java | 121 +++---- .../java/org/allaymc/api/world/World.java | 8 +- .../java/org/allaymc/api/world/WorldData.java | 3 +- .../allaymc/api/world/biome/BiomeData.java | 34 +- .../allaymc/api/world/bitarray/BitArray.java | 1 - .../api/world/bitarray/BitArrayVersion.java | 3 +- .../api/world/bitarray/PaddedBitArray.java | 13 +- .../api/world/bitarray/Pow2BitArray.java | 17 +- .../org/allaymc/api/world/chunk/Chunk.java | 6 +- .../allaymc/api/world/chunk/ChunkSection.java | 30 +- .../api/world/chunk/EntityOperate.java | 2 - .../allaymc/api/world/chunk/UnsafeChunk.java | 10 +- .../allaymc/api/world/gamerule/GameRule.java | 15 +- .../allaymc/api/world/gamerule/GameRules.java | 15 +- .../api/world/generator/WorldGenerator.java | 17 +- .../world/generator/WorldGeneratorType.java | 7 +- .../api/world/generator/context/Context.java | 8 +- .../generator/context/EntitySpawnContext.java | 2 - .../context/OtherChunkAccessibleContext.java | 19 +- .../world/generator/function/Populator.java | 2 +- .../api/world/heightmap/HeightMap.java | 15 +- .../allaymc/api/world/palette/Palette.java | 99 +++--- .../world/storage/NativeFileWorldStorage.java | 1 - .../allaymc/api/zlib/ZlibProviderType.java | 5 +- .../codegen/VanillaBlockPropertyTypeGen.java | 23 +- .../java/org/allaymc/server/AllayServer.java | 5 +- .../AllayVanillaBlockAttributeRegistry.java | 2 +- .../common/BlockBaseComponentImpl.java | 2 +- ...allWheatSeedDropableBaseComponentImpl.java | 6 +- ...ockWheatSeedDropableBaseComponentImpl.java | 4 +- .../BlockShulkerBoxBaseComponentImpl.java | 12 +- .../registry/AllayBlockTypeRegistry.java | 35 +- .../block/type/BlockTypeBuildException.java | 3 - .../block/type/BlockTypeInitializer.java | 2 +- .../player/EntityPlayerBaseComponentImpl.java | 4 +- .../common/ItemBaseComponentImpl.java | 2 +- .../enchantment/AllayEnchantmentRegistry.java | 4 +- 241 files changed, 1670 insertions(+), 1817 deletions(-) delete mode 100644 Allay-API/src/main/java/org/allaymc/api/block/property/enums/CoralColor.java delete mode 100644 Allay-API/src/main/java/org/allaymc/api/block/property/enums/DoublePlantType.java delete mode 100644 Allay-API/src/main/java/org/allaymc/api/block/property/enums/FlowerType.java delete mode 100644 Allay-API/src/main/java/org/allaymc/api/block/property/enums/SaplingType.java delete mode 100644 Allay-API/src/main/java/org/allaymc/api/block/property/enums/TallGrassType.java diff --git a/Allay-API/src/main/java/org/allaymc/api/AllayAPI.java b/Allay-API/src/main/java/org/allaymc/api/AllayAPI.java index 2ffd674c4..dea8bf435 100644 --- a/Allay-API/src/main/java/org/allaymc/api/AllayAPI.java +++ b/Allay-API/src/main/java/org/allaymc/api/AllayAPI.java @@ -85,23 +85,22 @@ public static AllayAPI getInstance() { */ @SuppressWarnings("unchecked") public void implement(String coreName) throws MissingImplementationException { - if (!i18nSet) { - throw new MissingImplementationException("Missing i18n implementation!"); - } - for (Map.Entry, ApiBindingAction> entry : bindings.entrySet()) { - if (entry.getValue() == null) { + if (!i18nSet) throw new MissingImplementationException("Missing i18n implementation!"); + for (var entry : bindings.entrySet()) { + if (entry.getValue() == null) throw new MissingImplementationException("Missing binding for " + entry.getKey().getName()); - } + var apiInstance = entry.getValue().bindingAction.get(); - Consumer consumer = (Consumer) consumers.get(entry.getKey()); - if (consumer == null) { + var consumer = (Consumer) consumers.get(entry.getKey()); + if (consumer == null) throw new MissingRequirementException("Missing requirement for " + entry.getKey().getName()); - } + consumer.accept(apiInstance); if (entry.getValue().afterBound != null) { ((Consumer) entry.getValue().afterBound).accept(apiInstance); } } + this.coreName = coreName; log.info(I18n.get().tr(TrKeys.A_API_IMPLEMENTED, coreName, API_VERSION)); implemented = true; @@ -119,9 +118,7 @@ public void requireImpl(Class api) { */ public void requireImpl(Class api, Consumer apiInstanceConsumer) { bindings.put(api, null); - if (apiInstanceConsumer != null) { - consumers.put(api, apiInstanceConsumer); - } + if (apiInstanceConsumer != null) consumers.put(api, apiInstanceConsumer); } public void bind(Class api, Supplier supplier) { @@ -212,6 +209,5 @@ private void defaultAPIRequirements() { requireImpl(PackRegistry.class, PackRegistry.REGISTRY::set); } - private record ApiBindingAction(Supplier bindingAction, Consumer afterBound) { - } -} \ No newline at end of file + private record ApiBindingAction(Supplier bindingAction, Consumer afterBound) {} +} diff --git a/Allay-API/src/main/java/org/allaymc/api/annotation/SlowOperation.java b/Allay-API/src/main/java/org/allaymc/api/annotation/SlowOperation.java index 9b32e5efb..3d54590d4 100644 --- a/Allay-API/src/main/java/org/allaymc/api/annotation/SlowOperation.java +++ b/Allay-API/src/main/java/org/allaymc/api/annotation/SlowOperation.java @@ -6,7 +6,8 @@ import java.lang.annotation.Target; /** - * An annotation used to mark a method as being slow or blocking a thread
+ * An annotation used to mark a method as being slow or blocking a thread + *

* It usually means that you may need to call it asynchronously *

* Allay Project 2023/7/8 diff --git a/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockAttributes.java b/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockAttributes.java index de693223d..c6594f152 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockAttributes.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockAttributes.java @@ -97,8 +97,8 @@ public class BlockAttributes { @Builder.Default protected boolean pushesUpFallingBlocks = false; /** - * 此方块状态是否可以被徒手挖取 - * 若可以,则玩家在非创造模式下可以使用任何工具挖取此方块并产生掉落物 + * Whether this block state can be harvested by hand + * If true, players in non-creative mode can use any tool to mine this block and produce drops */ @Builder.Default protected boolean canHarvestWithHand = true; diff --git a/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockBaseComponent.java b/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockBaseComponent.java index 9448c1940..a0665c286 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockBaseComponent.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/component/common/BlockBaseComponent.java @@ -59,8 +59,10 @@ default void updateBlockProperty(BlockPropertyType property /** * Check if the block can keep existing when a neighbor block updates. + * * @param current The current block - * @param face The face of the current block that is being updated + * @param face The face of the current block that is being updated + * * @return true if the block can keep existing, false if the block should be broken */ default boolean canKeepExisting(BlockStateWithPos current, BlockStateWithPos neighbor, BlockFace face) { @@ -96,10 +98,7 @@ default void checkPlaceMethodParam(Dimension dimension, BlockState blockState, V * * @return true if the block is placed successfully, false if failed */ - boolean place( - Dimension dimension, BlockState blockState, - Vector3ic placeBlockPos, - PlayerInteractInfo placementInfo); + boolean place(Dimension dimension, BlockState blockState, Vector3ic placeBlockPos, PlayerInteractInfo placementInfo); /** * Called when a block is placed. @@ -120,9 +119,7 @@ boolean place( * For example, right-clicking on the crafting table is normally considered a valid operation, so this method will return true * If false is returned, the useItemOn method of the player's item will continue to be called */ - boolean onInteract( - ItemStack itemStack, Dimension dimension, - PlayerInteractInfo interactInfo); + boolean onInteract(ItemStack itemStack, Dimension dimension, PlayerInteractInfo interactInfo); /** * Called when a block is replaced. diff --git a/Allay-API/src/main/java/org/allaymc/api/block/component/common/PlayerInteractInfo.java b/Allay-API/src/main/java/org/allaymc/api/block/component/common/PlayerInteractInfo.java index d7882d0c7..42b5bd47b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/component/common/PlayerInteractInfo.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/component/common/PlayerInteractInfo.java @@ -8,10 +8,10 @@ /** * Allay Project 2024/6/20 * - * @param player The player who is placing the block + * @param player The player who is placing the block * @param clickBlockPos The block that the player clicked on - * @param clickPos The precise pos where the player clicked - * @param blockFace The face of the block that the player clicked on + * @param clickPos The precise pos where the player clicked + * @param blockFace The face of the block that the player clicked on * * @author daoge_cmd */ diff --git a/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnInteractEvent.java b/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnInteractEvent.java index 7d338948d..d2b92d3e2 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnInteractEvent.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnInteractEvent.java @@ -4,13 +4,9 @@ import lombok.Getter; import lombok.Setter; import org.allaymc.api.block.component.common.PlayerInteractInfo; -import org.allaymc.api.block.data.BlockFace; -import org.allaymc.api.entity.interfaces.EntityPlayer; import org.allaymc.api.eventbus.event.Event; import org.allaymc.api.item.ItemStack; import org.allaymc.api.world.Dimension; -import org.joml.Vector3fc; -import org.joml.Vector3ic; /** * Allay Project 2023/9/23 diff --git a/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnNeighborUpdateEvent.java b/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnNeighborUpdateEvent.java index 9101adf75..704eb5d41 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnNeighborUpdateEvent.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/component/event/BlockOnNeighborUpdateEvent.java @@ -5,8 +5,6 @@ import org.allaymc.api.block.data.BlockFace; import org.allaymc.api.block.data.BlockStateWithPos; import org.allaymc.api.eventbus.event.Event; -import org.allaymc.api.world.Dimension; -import org.joml.Vector3ic; /** * Allay Project 2023/9/23 diff --git a/Allay-API/src/main/java/org/allaymc/api/block/material/Material.java b/Allay-API/src/main/java/org/allaymc/api/block/material/Material.java index 7ea2c0cce..960cede3a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/material/Material.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/material/Material.java @@ -24,9 +24,9 @@ public record Material( MaterialType materialType, boolean canBeMovingBlock, boolean canHavePrecipitation, - //isAlwaysDestroyable为true时,表示方块可以被任何物品破坏(甚至是空手)而不产生挖掘惩罚 - //部分方块(例如石头,黑曜石)不可以被徒手挖去。若强行挖取它们,挖掘速度会受到惩罚(baseTime增大5倍,正常是1.5倍) - //请注意,isAlwaysDestroyable为true不代表方块一定可以掉落为物品! + // When isAlwaysDestroyable is true, it means the block can be destroyed by any item (even bare hands) without incurring a mining penalty. + // Some blocks (such as stone and obsidian) cannot be mined by hand. If you try to mine them, the mining speed will be penalized (baseTime increased by 5 times, normally it's 1.5 times). + // Note that isAlwaysDestroyable being true does not mean the block will necessarily drop as an item! boolean isAlwaysDestroyable, boolean isLiquid, boolean isSolid, diff --git a/Allay-API/src/main/java/org/allaymc/api/block/material/MaterialType.java b/Allay-API/src/main/java/org/allaymc/api/block/material/MaterialType.java index 3f1da5119..c9cf91574 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/material/MaterialType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/material/MaterialType.java @@ -6,5 +6,4 @@ * @author daoge_cmd */ public record MaterialType(String name) { - } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/palette/BlockStateHashPalette.java b/Allay-API/src/main/java/org/allaymc/api/block/palette/BlockStateHashPalette.java index 8e20cde01..ac743b2f0 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/palette/BlockStateHashPalette.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/palette/BlockStateHashPalette.java @@ -21,14 +21,11 @@ static BlockStateHashPalette getRegistry() { @Override default BlockState register(Integer hash, BlockState blockState) { if (getContent().containsKey(hash)) - throw new BlockStateHashCollisionException("Checked for possible block state hash collisions! Hash: " + hash + " ,BlockState: " + blockState); + throw new BlockStateHashCollisionException("Checked for possible block state hash collisions! Hash: " + hash + ", BlockState: " + blockState); else return MappedRegistry.super.register(hash, blockState); } class BlockStateHashCollisionException extends RuntimeException { - public BlockStateHashCollisionException() { - } - public BlockStateHashCollisionException(String message) { super(message); } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/PropertyUtil.java b/Allay-API/src/main/java/org/allaymc/api/block/property/PropertyUtil.java index 3e86a2db8..9af49f4b7 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/PropertyUtil.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/PropertyUtil.java @@ -1,5 +1,6 @@ package org.allaymc.api.block.property; +import lombok.experimental.UtilityClass; import org.allaymc.api.block.data.BlockFace; import org.allaymc.api.block.property.enums.MinecraftCardinalDirection; @@ -8,6 +9,7 @@ * * @author daoge_cmd */ +@UtilityClass public class PropertyUtil { public static MinecraftCardinalDirection toMinecraftCardinalDirection(BlockFace face) { return switch (face) { diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Attachment.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Attachment.java index c737e02ce..340c6dea9 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Attachment.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Attachment.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum Attachment { - HANGING, + HANGING, - MULTIPLE, + MULTIPLE, - SIDE, + SIDE, - STANDING + STANDING } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooLeafSize.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooLeafSize.java index 528e52c6a..7824e188a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooLeafSize.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooLeafSize.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum BambooLeafSize { - LARGE_LEAVES, + LARGE_LEAVES, - NO_LEAVES, + NO_LEAVES, - SMALL_LEAVES + SMALL_LEAVES } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooStalkThickness.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooStalkThickness.java index d7b3cfed2..f1a07de7b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooStalkThickness.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BambooStalkThickness.java @@ -1,12 +1,14 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum BambooStalkThickness { - THICK, + THICK, - THIN + THIN } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BigDripleafTilt.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BigDripleafTilt.java index 418fbc680..92b597cc2 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BigDripleafTilt.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/BigDripleafTilt.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum BigDripleafTilt { - FULL_TILT, + FULL_TILT, - NONE, + NONE, - PARTIAL_TILT, + PARTIAL_TILT, - UNSTABLE + UNSTABLE } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CauldronLiquid.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CauldronLiquid.java index 216a5328a..c0911eb04 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CauldronLiquid.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CauldronLiquid.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum CauldronLiquid { - LAVA, + LAVA, - POWDER_SNOW, + POWDER_SNOW, - WATER + WATER } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChemistryTableType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChemistryTableType.java index a5cef96e9..4fa33e3af 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChemistryTableType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChemistryTableType.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum ChemistryTableType { - COMPOUND_CREATOR, + COMPOUND_CREATOR, - ELEMENT_CONSTRUCTOR, + ELEMENT_CONSTRUCTOR, - LAB_TABLE, + LAB_TABLE, - MATERIAL_REDUCER + MATERIAL_REDUCER } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChiselType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChiselType.java index b986ae24f..125a7d105 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChiselType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/ChiselType.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum ChiselType { - CHISELED, + CHISELED, - DEFAULT, + DEFAULT, - LINES, + LINES, - SMOOTH + SMOOTH } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CoralColor.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CoralColor.java deleted file mode 100644 index 85285f467..000000000 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CoralColor.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.allaymc.api.block.property.enums; - -/** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

- * - * @author daoge_cmd - */ -public enum CoralColor { - BLUE, - - PINK, - - PURPLE, - - RED, - - YELLOW -} diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CrackedState.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CrackedState.java index 7db0c99d9..90915bd32 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CrackedState.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/CrackedState.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum CrackedState { - CRACKED, + CRACKED, - MAX_CRACKED, + MAX_CRACKED, - NO_CRACKS + NO_CRACKS } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Damage.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Damage.java index c56842165..98704c857 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Damage.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Damage.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum Damage { - BROKEN, + BROKEN, - SLIGHTLY_DAMAGED, + SLIGHTLY_DAMAGED, - UNDAMAGED, + UNDAMAGED, - VERY_DAMAGED + VERY_DAMAGED } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DirtType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DirtType.java index 300528ad2..69bcca061 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DirtType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DirtType.java @@ -1,12 +1,14 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum DirtType { - COARSE, + COARSE, - NORMAL + NORMAL } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DoublePlantType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DoublePlantType.java deleted file mode 100644 index aca559f42..000000000 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DoublePlantType.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.allaymc.api.block.property.enums; - -/** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

- * - * @author daoge_cmd - */ -public enum DoublePlantType { - FERN, - - GRASS, - - PAEONIA, - - ROSE, - - SUNFLOWER, - - SYRINGA -} diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DripstoneThickness.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DripstoneThickness.java index 02aef4b11..2f29f5abe 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DripstoneThickness.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/DripstoneThickness.java @@ -1,18 +1,20 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum DripstoneThickness { - BASE, + BASE, - FRUSTUM, + FRUSTUM, - MERGE, + MERGE, - MIDDLE, + MIDDLE, - TIP + TIP } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/FlowerType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/FlowerType.java deleted file mode 100644 index 9d8bb3b5c..000000000 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/FlowerType.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.allaymc.api.block.property.enums; - -/** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

- * - * @author daoge_cmd - */ -public enum FlowerType { - ALLIUM, - - CORNFLOWER, - - HOUSTONIA, - - LILY_OF_THE_VALLEY, - - ORCHID, - - OXEYE, - - POPPY, - - TULIP_ORANGE, - - TULIP_PINK, - - TULIP_RED, - - TULIP_WHITE -} diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/LeverDirection.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/LeverDirection.java index 049224ced..0d36e6739 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/LeverDirection.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/LeverDirection.java @@ -1,24 +1,26 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum LeverDirection { - DOWN_EAST_WEST, + DOWN_EAST_WEST, - DOWN_NORTH_SOUTH, + DOWN_NORTH_SOUTH, - EAST, + EAST, - NORTH, + NORTH, - SOUTH, + SOUTH, - UP_EAST_WEST, + UP_EAST_WEST, - UP_NORTH_SOUTH, + UP_NORTH_SOUTH, - WEST + WEST } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftBlockFace.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftBlockFace.java index cf9ac7be9..c3186f4a4 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftBlockFace.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftBlockFace.java @@ -1,20 +1,22 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum MinecraftBlockFace { - DOWN, + DOWN, - EAST, + EAST, - NORTH, + NORTH, - SOUTH, + SOUTH, - UP, + UP, - WEST + WEST } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftCardinalDirection.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftCardinalDirection.java index 0907034d6..7e89ca0c4 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftCardinalDirection.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftCardinalDirection.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum MinecraftCardinalDirection { - EAST, + EAST, - NORTH, + NORTH, - SOUTH, + SOUTH, - WEST + WEST } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftFacingDirection.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftFacingDirection.java index f41fbe10f..2972cd261 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftFacingDirection.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftFacingDirection.java @@ -1,20 +1,22 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum MinecraftFacingDirection { - DOWN, + DOWN, - EAST, + EAST, - NORTH, + NORTH, - SOUTH, + SOUTH, - UP, + UP, - WEST + WEST } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftVerticalHalf.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftVerticalHalf.java index ae9da33c7..fda94b2eb 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftVerticalHalf.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MinecraftVerticalHalf.java @@ -1,12 +1,14 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum MinecraftVerticalHalf { - BOTTOM, + BOTTOM, - TOP + TOP } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MonsterEggStoneType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MonsterEggStoneType.java index 4380defdf..24f5a8ed0 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MonsterEggStoneType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/MonsterEggStoneType.java @@ -1,20 +1,22 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum MonsterEggStoneType { - CHISELED_STONE_BRICK, + CHISELED_STONE_BRICK, - COBBLESTONE, + COBBLESTONE, - CRACKED_STONE_BRICK, + CRACKED_STONE_BRICK, - MOSSY_STONE_BRICK, + MOSSY_STONE_BRICK, - STONE, + STONE, - STONE_BRICK + STONE_BRICK } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Orientation.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Orientation.java index ce3d902fd..5714cc400 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Orientation.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/Orientation.java @@ -1,32 +1,34 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum Orientation { - DOWN_EAST, + DOWN_EAST, - DOWN_NORTH, + DOWN_NORTH, - DOWN_SOUTH, + DOWN_SOUTH, - DOWN_WEST, + DOWN_WEST, - EAST_UP, + EAST_UP, - NORTH_UP, + NORTH_UP, - SOUTH_UP, + SOUTH_UP, - UP_EAST, + UP_EAST, - UP_NORTH, + UP_NORTH, - UP_SOUTH, + UP_SOUTH, - UP_WEST, + UP_WEST, - WEST_UP + WEST_UP } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PillarAxis.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PillarAxis.java index 9feebbd12..b84ca9dda 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PillarAxis.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PillarAxis.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum PillarAxis { - X, + X, - Y, + Y, - Z + Z } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PortalAxis.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PortalAxis.java index fd9084d1a..3af082440 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PortalAxis.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PortalAxis.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum PortalAxis { - UNKNOWN, + UNKNOWN, - X, + X, - Z + Z } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PrismarineBlockType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PrismarineBlockType.java index dcf545745..d11f46e38 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PrismarineBlockType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/PrismarineBlockType.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum PrismarineBlockType { - BRICKS, + BRICKS, - DARK, + DARK, - DEFAULT + DEFAULT } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandStoneType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandStoneType.java index 99e304449..4698d5a41 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandStoneType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandStoneType.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum SandStoneType { - CUT, + CUT, - DEFAULT, + DEFAULT, - HEIROGLYPHS, + HEIROGLYPHS, - SMOOTH + SMOOTH } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandType.java index 7bdd5a642..6b53d50cf 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SandType.java @@ -1,12 +1,14 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum SandType { - NORMAL, + NORMAL, - RED + RED } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SaplingType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SaplingType.java deleted file mode 100644 index d252cef2e..000000000 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SaplingType.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.allaymc.api.block.property.enums; - -/** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

- * - * @author daoge_cmd - */ -public enum SaplingType { - ACACIA, - - BIRCH, - - DARK_OAK, - - JUNGLE, - - OAK, - - SPRUCE -} diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SeaGrassType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SeaGrassType.java index 7c256bf09..f19b75955 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SeaGrassType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SeaGrassType.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum SeaGrassType { - DEFAULT, + DEFAULT, - DOUBLE_BOT, + DOUBLE_BOT, - DOUBLE_TOP + DOUBLE_TOP } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SpongeType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SpongeType.java index c5641d9ac..31a9051b1 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SpongeType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/SpongeType.java @@ -1,12 +1,14 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum SpongeType { - DRY, + DRY, - WET + WET } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneBrickType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneBrickType.java index 263557209..03c827341 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneBrickType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneBrickType.java @@ -1,18 +1,20 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StoneBrickType { - CHISELED, + CHISELED, - CRACKED, + CRACKED, - DEFAULT, + DEFAULT, - MOSSY, + MOSSY, - SMOOTH + SMOOTH } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType.java index 3725a9a8e..93fcb5c68 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType.java @@ -1,24 +1,26 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StoneSlabType { - BRICK, + BRICK, - COBBLESTONE, + COBBLESTONE, - NETHER_BRICK, + NETHER_BRICK, - QUARTZ, + QUARTZ, - SANDSTONE, + SANDSTONE, - SMOOTH_STONE, + SMOOTH_STONE, - STONE_BRICK, + STONE_BRICK, - WOOD + WOOD } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType2.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType2.java index 1bdc94d0e..6e05ab031 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType2.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType2.java @@ -1,24 +1,26 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StoneSlabType2 { - MOSSY_COBBLESTONE, + MOSSY_COBBLESTONE, - PRISMARINE_BRICK, + PRISMARINE_BRICK, - PRISMARINE_DARK, + PRISMARINE_DARK, - PRISMARINE_ROUGH, + PRISMARINE_ROUGH, - PURPUR, + PURPUR, - RED_NETHER_BRICK, + RED_NETHER_BRICK, - RED_SANDSTONE, + RED_SANDSTONE, - SMOOTH_SANDSTONE + SMOOTH_SANDSTONE } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType3.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType3.java index a76bd0545..52c15976e 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType3.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType3.java @@ -1,24 +1,26 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StoneSlabType3 { - ANDESITE, + ANDESITE, - DIORITE, + DIORITE, - END_STONE_BRICK, + END_STONE_BRICK, - GRANITE, + GRANITE, - POLISHED_ANDESITE, + POLISHED_ANDESITE, - POLISHED_DIORITE, + POLISHED_DIORITE, - POLISHED_GRANITE, + POLISHED_GRANITE, - SMOOTH_RED_SANDSTONE + SMOOTH_RED_SANDSTONE } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType4.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType4.java index 932c51c86..a672a785e 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType4.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StoneSlabType4.java @@ -1,18 +1,20 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StoneSlabType4 { - CUT_RED_SANDSTONE, + CUT_RED_SANDSTONE, - CUT_SANDSTONE, + CUT_SANDSTONE, - MOSSY_STONE_BRICK, + MOSSY_STONE_BRICK, - SMOOTH_QUARTZ, + SMOOTH_QUARTZ, - STONE + STONE } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureBlockType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureBlockType.java index c69848149..6a5d93c61 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureBlockType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureBlockType.java @@ -1,20 +1,22 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StructureBlockType { - CORNER, + CORNER, - DATA, + DATA, - EXPORT, + EXPORT, - INVALID, + INVALID, - LOAD, + LOAD, - SAVE + SAVE } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureVoidType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureVoidType.java index 9b8c7ed0b..9a83d57a0 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureVoidType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/StructureVoidType.java @@ -1,12 +1,14 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum StructureVoidType { - AIR, + AIR, - VOID + VOID } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TallGrassType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TallGrassType.java deleted file mode 100644 index 0a4702a01..000000000 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TallGrassType.java +++ /dev/null @@ -1,17 +0,0 @@ -package org.allaymc.api.block.property.enums; - -/** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

- * - * @author daoge_cmd - */ -public enum TallGrassType { - DEFAULT, - - FERN, - - SNOW, - - TALL -} diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TorchFacingDirection.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TorchFacingDirection.java index e672932a7..d7146a01c 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TorchFacingDirection.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TorchFacingDirection.java @@ -1,20 +1,22 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum TorchFacingDirection { - EAST, + EAST, - NORTH, + NORTH, - SOUTH, + SOUTH, - TOP, + TOP, - UNKNOWN, + UNKNOWN, - WEST + WEST } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TurtleEggCount.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TurtleEggCount.java index 69a342891..0ddef3560 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TurtleEggCount.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/TurtleEggCount.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum TurtleEggCount { - FOUR_EGG, + FOUR_EGG, - ONE_EGG, + ONE_EGG, - THREE_EGG, + THREE_EGG, - TWO_EGG + TWO_EGG } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/VaultState.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/VaultState.java index f10963bbf..8a92b126d 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/VaultState.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/VaultState.java @@ -1,16 +1,18 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum VaultState { - ACTIVE, + ACTIVE, - EJECTING, + EJECTING, - INACTIVE, + INACTIVE, - UNLOCKING + UNLOCKING } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallBlockType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallBlockType.java index 536997bfe..1e7b14573 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallBlockType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallBlockType.java @@ -1,36 +1,38 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum WallBlockType { - ANDESITE, + ANDESITE, - BRICK, + BRICK, - COBBLESTONE, + COBBLESTONE, - DIORITE, + DIORITE, - END_BRICK, + END_BRICK, - GRANITE, + GRANITE, - MOSSY_COBBLESTONE, + MOSSY_COBBLESTONE, - MOSSY_STONE_BRICK, + MOSSY_STONE_BRICK, - NETHER_BRICK, + NETHER_BRICK, - PRISMARINE, + PRISMARINE, - RED_NETHER_BRICK, + RED_NETHER_BRICK, - RED_SANDSTONE, + RED_SANDSTONE, - SANDSTONE, + SANDSTONE, - STONE_BRICK + STONE_BRICK } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeEast.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeEast.java index 45c60aa89..269a8413c 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeEast.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeEast.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum WallConnectionTypeEast { - NONE, + NONE, - SHORT, + SHORT, - TALL + TALL } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeNorth.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeNorth.java index 740bc18d1..a4b360812 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeNorth.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeNorth.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum WallConnectionTypeNorth { - NONE, + NONE, - SHORT, + SHORT, - TALL + TALL } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeSouth.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeSouth.java index 2d7391ed2..7eed1f40d 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeSouth.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeSouth.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum WallConnectionTypeSouth { - NONE, + NONE, - SHORT, + SHORT, - TALL + TALL } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeWest.java b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeWest.java index 8721119f7..5c5c08d51 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeWest.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/enums/WallConnectionTypeWest.java @@ -1,14 +1,16 @@ package org.allaymc.api.block.property.enums; /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public enum WallConnectionTypeWest { - NONE, + NONE, - SHORT, + SHORT, - TALL + TALL } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/type/BaseBlockPropertyType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/type/BaseBlockPropertyType.java index d016fde28..72e6d2fa0 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/type/BaseBlockPropertyType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/type/BaseBlockPropertyType.java @@ -1,5 +1,7 @@ package org.allaymc.api.block.property.type; +import lombok.Getter; + import java.util.List; import java.util.Objects; @@ -8,6 +10,7 @@ * * @author daoge_cmd */ +@Getter public abstract sealed class BaseBlockPropertyType implements BlockPropertyType permits BooleanPropertyType, EnumPropertyType, IntPropertyType { protected final String name; @@ -16,30 +19,9 @@ public abstract sealed class BaseBlockPropertyType implements BlockPro protected final byte bitSize; protected BaseBlockPropertyType(String name, List validValues, DATATYPE defaultValue, byte bitSize) { - Objects.requireNonNull(defaultValue); this.name = name; this.validValues = validValues; - this.defaultValue = defaultValue; + this.defaultValue = Objects.requireNonNull(defaultValue); this.bitSize = bitSize; } - - @Override - public String getName() { - return name; - } - - @Override - public DATATYPE getDefaultValue() { - return defaultValue; - } - - @Override - public List getValidValues() { - return validValues; - } - - @Override - public byte getBitSize() { - return bitSize; - } } diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/type/BlockPropertyType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/type/BlockPropertyType.java index 3812a660b..18bb12bbe 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/type/BlockPropertyType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/type/BlockPropertyType.java @@ -1,5 +1,6 @@ package org.allaymc.api.block.property.type; +import lombok.AllArgsConstructor; import lombok.Getter; import lombok.ToString; @@ -46,16 +47,12 @@ enum Type { @Getter @ToString + @AllArgsConstructor abstract sealed class BlockPropertyValue, SERIALIZED_DATATYPE> permits BooleanPropertyType.BooleanPropertyValue, EnumPropertyType.EnumPropertyValue, IntPropertyType.IntPropertyValue { protected final PROPERTY propertyType; protected final DATATYPE value; - BlockPropertyValue(PROPERTY propertyType, DATATYPE value) { - this.propertyType = propertyType; - this.value = value; - } - public abstract int getIndex(); public abstract SERIALIZED_DATATYPE getSerializedValue(); diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/type/BooleanPropertyType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/type/BooleanPropertyType.java index 961267d90..d7e4c3abb 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/type/BooleanPropertyType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/type/BooleanPropertyType.java @@ -1,5 +1,7 @@ package org.allaymc.api.block.property.type; +import lombok.Getter; + import java.util.List; /** @@ -43,17 +45,12 @@ public BooleanPropertyValue tryCreateValue(Object value) { } public final class BooleanPropertyValue extends BlockPropertyValue { - + @Getter private final int index; BooleanPropertyValue(Boolean value) { super(BooleanPropertyType.this, value); - index = value ? 1 : 0; - } - - @Override - public int getIndex() { - return index; + this.index = value ? 1 : 0; } @Override diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/type/EnumPropertyType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/type/EnumPropertyType.java index 475a1083d..62ae12231 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/type/EnumPropertyType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/type/EnumPropertyType.java @@ -1,5 +1,6 @@ package org.allaymc.api.block.property.type; +import lombok.Getter; import org.allaymc.api.utils.Utils; import java.util.Arrays; @@ -51,12 +52,12 @@ public EnumPropertyValue tryCreateValue(Object value) { } public final class EnumPropertyValue extends BlockPropertyValue, String> { - + @Getter private final String serializedValue; EnumPropertyValue(T value) { super(EnumPropertyType.this, value); - serializedValue = value.name().toLowerCase(); + this.serializedValue = value.name().toLowerCase(); } @Override @@ -64,11 +65,6 @@ public int getIndex() { return value.ordinal(); } - @Override - public String getSerializedValue() { - return serializedValue; - } - @Override public String toString() { return "EnumPropertyValue(name=" + name + ", value=" + value + ")"; diff --git a/Allay-API/src/main/java/org/allaymc/api/block/property/type/IntPropertyType.java b/Allay-API/src/main/java/org/allaymc/api/block/property/type/IntPropertyType.java index d01e41d54..ea4f3b96b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/block/property/type/IntPropertyType.java +++ b/Allay-API/src/main/java/org/allaymc/api/block/property/type/IntPropertyType.java @@ -1,5 +1,6 @@ package org.allaymc.api.block.property.type; +import lombok.AccessLevel; import lombok.Getter; import org.allaymc.api.utils.Utils; @@ -10,22 +11,20 @@ * * @author daoge_cmd */ +@Getter public final class IntPropertyType extends BaseBlockPropertyType { - + @Getter(AccessLevel.NONE) private final IntPropertyValue[] cachedValues; - @Getter - private final int min; - @Getter - private final int max; + private final int min, max; private IntPropertyType(String name, int min, int max, Integer defaultData) { super(name, IntStream.range(min, max + 1).boxed().toList(), defaultData, Utils.computeRequiredBits(max - min + 1)); this.min = min; this.max = max; - cachedValues = new IntPropertyValue[max + 1 - min]; + + this.cachedValues = new IntPropertyValue[max + 1 - min]; for (int i = min; i <= max; i++) { - IntPropertyValue value = new IntPropertyValue(i); - cachedValues[i] = value; + this.cachedValues[i] = new IntPropertyValue(i); } } diff --git a/Allay-API/src/main/java/org/allaymc/api/blockentity/BlockEntityHelper.java b/Allay-API/src/main/java/org/allaymc/api/blockentity/BlockEntityHelper.java index 31f98c825..7cc70a024 100644 --- a/Allay-API/src/main/java/org/allaymc/api/blockentity/BlockEntityHelper.java +++ b/Allay-API/src/main/java/org/allaymc/api/blockentity/BlockEntityHelper.java @@ -1,5 +1,6 @@ package org.allaymc.api.blockentity; +import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; import org.allaymc.api.blockentity.init.SimpleBlockEntityInitInfo; import org.allaymc.api.blockentity.registry.BlockEntityTypeRegistry; @@ -12,12 +13,13 @@ * @author daoge_cmd */ @Slf4j +@UtilityClass public final class BlockEntityHelper { public static BlockEntity fromNBT(Dimension dimension, NbtMap nbt) { var id = nbt.getString("id"); var blockEntityType = BlockEntityTypeRegistry.getRegistry().get(id); if (blockEntityType == null) { - log.warn("Unknown block entity type: " + id); + log.warn("Unknown block entity type: {}", id); return null; } return blockEntityType.createBlockEntity(SimpleBlockEntityInitInfo.builder().dimension(dimension).nbt(nbt).build()); diff --git a/Allay-API/src/main/java/org/allaymc/api/blockentity/init/SimpleBlockEntityInitInfo.java b/Allay-API/src/main/java/org/allaymc/api/blockentity/init/SimpleBlockEntityInitInfo.java index 03b34a25f..8e5e3a1cb 100644 --- a/Allay-API/src/main/java/org/allaymc/api/blockentity/init/SimpleBlockEntityInitInfo.java +++ b/Allay-API/src/main/java/org/allaymc/api/blockentity/init/SimpleBlockEntityInitInfo.java @@ -1,6 +1,8 @@ package org.allaymc.api.blockentity.init; +import lombok.AccessLevel; import lombok.Getter; +import lombok.RequiredArgsConstructor; import lombok.Setter; import org.allaymc.api.blockentity.BlockEntity; import org.allaymc.api.blockentity.type.BlockEntityType; @@ -13,6 +15,7 @@ * * @author daoge_cmd */ +@RequiredArgsConstructor(access = AccessLevel.PROTECTED) public class SimpleBlockEntityInitInfo implements BlockEntityInitInfo { private final Dimension dimension; private final NbtMap nbt; @@ -20,11 +23,6 @@ public class SimpleBlockEntityInitInfo implements BlockEn @Setter private BlockEntityType blockEntityType; - protected SimpleBlockEntityInitInfo(Dimension dimension, NbtMap nbt) { - this.dimension = dimension; - this.nbt = nbt; - } - public static Builder builder() { return new Builder(); } diff --git a/Allay-API/src/main/java/org/allaymc/api/blockentity/interfaces/BlockEntityBarrel.java b/Allay-API/src/main/java/org/allaymc/api/blockentity/interfaces/BlockEntityBarrel.java index d9907e844..1b9407ee0 100644 --- a/Allay-API/src/main/java/org/allaymc/api/blockentity/interfaces/BlockEntityBarrel.java +++ b/Allay-API/src/main/java/org/allaymc/api/blockentity/interfaces/BlockEntityBarrel.java @@ -9,5 +9,4 @@ * @author daoge_cmd */ public interface BlockEntityBarrel extends BlockEntity, BlockEntityContainerHolderComponent { - } diff --git a/Allay-API/src/main/java/org/allaymc/api/client/data/Abilities.java b/Allay-API/src/main/java/org/allaymc/api/client/data/Abilities.java index 693b739c1..52f972c04 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/data/Abilities.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/data/Abilities.java @@ -23,6 +23,7 @@ * * @author daoge_cmd */ +@Getter public final class Abilities { public static final float DEFAULT_WALK_SPEED = 0.1f; @@ -32,12 +33,9 @@ public final class Abilities { private final EntityPlayer player; - @Getter private float walkSpeed = DEFAULT_WALK_SPEED; - @Getter private float flySpeed = DEFAULT_FLY_SPEED; - @Getter private boolean dirty = false; public Abilities(EntityPlayer player) { @@ -56,7 +54,7 @@ public Abilities(EntityPlayer player) { public void applyGameType(GameType gameType) { var tree = player.getPermTree(); - // 只设置必须设置的权限 + // Set only necessary permissions tree.setPerm(PermKeys.BUILD, gameType != GameType.SPECTATOR); tree.setPerm(PermKeys.MINE, gameType != GameType.SPECTATOR); tree.setPerm(PermKeys.DOORS_AND_SWITCHES, gameType != GameType.SPECTATOR); @@ -64,12 +62,13 @@ public void applyGameType(GameType gameType) { tree.setPerm(PermKeys.ATTACK_PLAYERS, gameType != GameType.SPECTATOR); tree.setPerm(PermKeys.ATTACK_MOBS, gameType != GameType.SPECTATOR); tree.setPerm(PermKeys.MAY_FLY, gameType != GameType.SURVIVAL && gameType != GameType.ADVENTURE); - // 不需要管SUMMON_LIGHTNING和CHAT,让插件可以控制而不会在切换模式后重置 - // 以下的几个能力不需要集成到权限树里面 + // Do not need to manage SUMMON_LIGHTNING and CHAT; + // allow plugins to control without resetting after mode switch + // The following abilities do not need to be integrated into the permission tree set(Ability.NO_CLIP, gameType == GameType.SPECTATOR); set(Ability.FLYING, gameType == GameType.SPECTATOR); set(Ability.INSTABUILD, gameType == GameType.CREATIVE); - // 这边设置这个OPERATOR_COMMANDS的目的仅仅是让OP客户端能显示快捷指令 + // The purpose of setting OPERATOR_COMMANDS here is solely to allow OP clients to display quick commands set(Ability.OPERATOR_COMMANDS, player.isOp()); set(Ability.TELEPORT, true); dirty = true; @@ -136,10 +135,11 @@ private Consumer syncTo(Ability ability, boolean revers private UpdateAbilitiesPacket createUpdateAbilitiesPacket() { UpdateAbilitiesPacket updateAbilitiesPacket = new UpdateAbilitiesPacket(); updateAbilitiesPacket.setUniqueEntityId(player.getRuntimeId()); - // 这边设置的命令权限其实没啥用,主要作用是让op能拥有快捷指令选项 - // 若此玩家没有指定命令的权限,命令描述压根就不会发到客户端 + // The command permissions set here are actually not very useful; + // their main function is to allow OPs to have quick command options + // If this player does not have specific command permissions, the command description won't even be sent to the client updateAbilitiesPacket.setCommandPermission(player.isOp() ? CommandPermission.GAME_DIRECTORS : CommandPermission.ANY); - // TODO: 检查旧的写法原因 + // TODO: Check reasons for the old writing style updateAbilitiesPacket.setPlayerPermission(player.isOp() /*&& player.getGameType() != GameType.SPECTATOR*/ ? PlayerPermission.OPERATOR : PlayerPermission.MEMBER); return updateAbilitiesPacket; } diff --git a/Allay-API/src/main/java/org/allaymc/api/client/data/AdventureSettings.java b/Allay-API/src/main/java/org/allaymc/api/client/data/AdventureSettings.java index ff91c7b27..e9a4c7b4b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/data/AdventureSettings.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/data/AdventureSettings.java @@ -20,12 +20,12 @@ public final class AdventureSettings { private final EntityPlayer player; + private boolean noPVM = false; private boolean noMVP = false; private boolean immutableWorld = false; private boolean showNameTags = true; private boolean autoJump = true; - @Getter private boolean dirty = false; public AdventureSettings(EntityPlayer player) { diff --git a/Allay-API/src/main/java/org/allaymc/api/client/data/Device.java b/Allay-API/src/main/java/org/allaymc/api/client/data/Device.java index 5e5c2d456..5e0052e96 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/data/Device.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/data/Device.java @@ -1,5 +1,6 @@ package org.allaymc.api.client.data; +import lombok.AllArgsConstructor; import lombok.Getter; /** @@ -8,8 +9,8 @@ * @author LucGamesYT | daoge_cmd */ @Getter +@AllArgsConstructor public enum Device { - UNKNOWN(-1), ANDROID(1), IOS(2), @@ -28,10 +29,6 @@ public enum Device { private final int id; - Device(int id) { - this.id = id; - } - public static Device getDevice(int id) { return switch (id) { case 1 -> ANDROID; diff --git a/Allay-API/src/main/java/org/allaymc/api/client/data/DeviceInfo.java b/Allay-API/src/main/java/org/allaymc/api/client/data/DeviceInfo.java index b6ee81358..50de3c798 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/data/DeviceInfo.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/data/DeviceInfo.java @@ -1,29 +1,15 @@ package org.allaymc.api.client.data; -import lombok.Getter; -import lombok.ToString; - /** * Allay Project 2023/6/23 * * @author LucGamesYT | daoge_cmd */ -@Getter -@ToString -public class DeviceInfo { - - private final String deviceName; - private final String deviceId; - private final long clientId; - private final Device device; - private final UIProfile UIProfile; - - public DeviceInfo(String deviceName, String deviceId, long clientId, Device device, UIProfile UIProfile) { - this.deviceName = deviceName; - this.deviceId = deviceId; - this.clientId = clientId; - this.device = device; - this.UIProfile = UIProfile; - } - +public record DeviceInfo( + String deviceName, + String deviceId, + long clientId, + Device device, + UIProfile UIProfile +) { } diff --git a/Allay-API/src/main/java/org/allaymc/api/client/data/LoginData.java b/Allay-API/src/main/java/org/allaymc/api/client/data/LoginData.java index 498e9e38a..2170e4e16 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/data/LoginData.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/data/LoginData.java @@ -75,7 +75,8 @@ private void decodeSkinData(String skinData) { JsonObject skinMap = decodeToken(skinData); if (skinMap.has("DeviceModel") && skinMap.has("DeviceId") && - skinMap.has("ClientRandomId") && skinMap.has("DeviceOS") && skinMap.has("GuiScale")) { + skinMap.has("ClientRandomId") && skinMap.has("DeviceOS") && + skinMap.has("GuiScale")) { String deviceModel = skinMap.get("DeviceModel").getAsString(); String deviceId = skinMap.get("DeviceId").getAsString(); long clientId = skinMap.get("ClientRandomId").getAsLong(); diff --git a/Allay-API/src/main/java/org/allaymc/api/client/data/UIProfile.java b/Allay-API/src/main/java/org/allaymc/api/client/data/UIProfile.java index 9a863a6ca..4546c0b51 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/data/UIProfile.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/data/UIProfile.java @@ -6,7 +6,6 @@ * @author LucGamesYT | daoge_cmd */ public enum UIProfile { - CLASSIC, POCKET; @@ -17,5 +16,4 @@ public static UIProfile getById(int id) { default -> null; }; } - } diff --git a/Allay-API/src/main/java/org/allaymc/api/client/skin/Image.java b/Allay-API/src/main/java/org/allaymc/api/client/skin/Image.java index 3cdd86ce8..1b776cfe7 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/skin/Image.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/skin/Image.java @@ -6,7 +6,6 @@ * @author LucGamesYT | daoge_cmd */ public record Image(int width, int height, byte[] data) { - public static Image getImage(byte[] data) { return switch (data.length) { case Skin.SINGLE_SKIN_SIZE -> new Image(64, 32, data); diff --git a/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPiece.java b/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPiece.java index 76bba5a96..092e65ea1 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPiece.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPiece.java @@ -5,6 +5,11 @@ * * @author LucGamesYT | daoge_cmd */ -public record PersonaPiece(String pieceId, String pieceType, String packId, String productId, boolean isDefault) { - +public record PersonaPiece( + String pieceId, + String pieceType, + String packId, + String productId, + boolean isDefault +) { } diff --git a/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPieceTint.java b/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPieceTint.java index ffaf12c6b..5907454b6 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPieceTint.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/skin/PersonaPieceTint.java @@ -8,5 +8,4 @@ * @author LucGamesYT | daoge_cmd */ public record PersonaPieceTint(String pieceType, List colors) { - } diff --git a/Allay-API/src/main/java/org/allaymc/api/client/skin/Skin.java b/Allay-API/src/main/java/org/allaymc/api/client/skin/Skin.java index a3aa5f4b1..cd1f2ccd4 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/skin/Skin.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/skin/Skin.java @@ -124,7 +124,13 @@ public static Skin fromFile(File file) { } public static String legacyGeometryName(String geometryName) { - return "{\"geometry\" : {\"default\" : \"" + geometryName + "\"}}"; + return """ + { + "geometry": { + "default": "%s" + } + } + """.formatted(geometryName); } public static Image parseBufferedImage(BufferedImage image) { @@ -232,8 +238,8 @@ public boolean isValid() { private boolean isValidSkin() { return skinId != null && !skinId.trim().isEmpty() && - skinData != null && skinData.width() >= 64 && skinData.height() >= 32 && - skinData.data().length >= SINGLE_SKIN_SIZE; + skinData != null && skinData.width() >= 64 && skinData.height() >= 32 && + skinData.data().length >= SINGLE_SKIN_SIZE; } private boolean isValidResourcePatch() { diff --git a/Allay-API/src/main/java/org/allaymc/api/client/skin/SkinAnimation.java b/Allay-API/src/main/java/org/allaymc/api/client/skin/SkinAnimation.java index 12264644a..595a3c90f 100644 --- a/Allay-API/src/main/java/org/allaymc/api/client/skin/SkinAnimation.java +++ b/Allay-API/src/main/java/org/allaymc/api/client/skin/SkinAnimation.java @@ -6,5 +6,4 @@ * @author LucGamesYT | daoge_cmd */ public record SkinAnimation(Image image, int type, float frames, int expression) { - } diff --git a/Allay-API/src/main/java/org/allaymc/api/command/CommandRegistry.java b/Allay-API/src/main/java/org/allaymc/api/command/CommandRegistry.java index df4f072a5..0f301504a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/CommandRegistry.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/CommandRegistry.java @@ -25,10 +25,10 @@ public interface CommandRegistry extends MappedRegistrywhether the sender is a player + * @return Whether the sender is a player */ default boolean isPlayer() { return false; } /** - * 请使用这个方法来检查发送者是否是一个实体,而不是使用代码{@code "xxx instanceof Entity"}.
- * 因为发送者可能不是{@code "Entity"}的一个实例,但实际上它是以一个实体的身份执行命令(例如:{@code "ExecutorCommandSender"}) - *

- * please use this method to check whether the sender is an entity instead of using code {@code "xxx instanceof Entity"}
- * because the sender may not an instance of {@code "Entity"} but in fact it is executing commands identity as an entity(eg: {@code "ExecutorCommandSender"}) + * Please use this method to check whether the sender is an entity instead of using code {@code "xxx instanceof Entity"}. + * Because the sender may not be an instance of {@code "Entity"} but is executing commands as an entity (e.g., {@code "ExecutorCommandSender"}). * - * @return 发送者是否为实体
whether the sender is an entity + * @return Whether the sender is an entity */ default boolean isEntity() { return false; } /** - * 如果发送者是一个实体,返回执行该命令的实体. - *

- * return the entity who execute the command if the sender is a entity. + * If the sender is an entity, returns the entity executing the command. * - * @return 实体对象
Entity instance + * @return Entity instance */ default Entity asEntity() { return null; } /** - * 如果发送者是一个玩家,返回执行该命令的玩家. - *

- * return the player who execute the command if the sender is a player. + * If the sender is a player, returns the player executing the command. * - * @return 玩家对象
Player instance + * @return Player instance */ default EntityPlayer asPlayer() { return null; diff --git a/Allay-API/src/main/java/org/allaymc/api/command/NPCCommandSender.java b/Allay-API/src/main/java/org/allaymc/api/command/NPCCommandSender.java index bf66d3911..a9eb2ee1b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/NPCCommandSender.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/NPCCommandSender.java @@ -22,6 +22,7 @@ public class NPCCommandSender implements CommandSender { private static final CommandOriginData NPC_COMMAND_ORIGIN_DATA = new CommandOriginData(CommandOriginType.ENTITY, UUID.randomUUID(), "", 0); + protected EntityNpc npc; protected EntityPlayer initiator; diff --git a/Allay-API/src/main/java/org/allaymc/api/command/SenderType.java b/Allay-API/src/main/java/org/allaymc/api/command/SenderType.java index cfbd6354c..3b6d60ff3 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/SenderType.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/SenderType.java @@ -17,7 +17,6 @@ public record SenderType( public static SenderType ANY = new SenderType<>(sender -> true, cs -> cs, ""); // Can't be a wrong executor public static SenderType SERVER = new SenderType<>(Server.class::isInstance, Server.class::cast, TrKeys.A_COMMAND_GENERIC_SENDER_NOTSERVER); public static SenderType PLAYER = new SenderType<>(CommandSender::isPlayer, CommandSender::asPlayer, TrKeys.A_COMMAND_GENERIC_SENDER_NOTPLAYER); - // TODO: entity sender type public static SenderType ENTITY = new SenderType<>(CommandSender::isEntity, CommandSender::asEntity, TrKeys.A_COMMAND_GENERIC_SENDER_NOTENTITY); public boolean validate(CommandSender sender) { diff --git a/Allay-API/src/main/java/org/allaymc/api/command/exception/CommandParseException.java b/Allay-API/src/main/java/org/allaymc/api/command/exception/CommandParseException.java index 5d19b9f83..2ad23be7a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/exception/CommandParseException.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/exception/CommandParseException.java @@ -6,9 +6,6 @@ * @author daoge_cmd */ public class CommandParseException extends RuntimeException { - public CommandParseException() { - } - public CommandParseException(String message) { super(message); } diff --git a/Allay-API/src/main/java/org/allaymc/api/command/selector/EntitySelectorAPI.java b/Allay-API/src/main/java/org/allaymc/api/command/selector/EntitySelectorAPI.java index ec82ec90a..a34fb1935 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/selector/EntitySelectorAPI.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/selector/EntitySelectorAPI.java @@ -24,30 +24,32 @@ static EntitySelectorAPI getAPI() { } /** - * 通过给定的命令发送者和目标选择器文本匹配实体 + * Matches entities based on the given command sender and target selector token. * - * @param sender 命令发送者 - * @param token 目标选择器文本 + * @param sender the command sender + * @param token the target selector token * - * @return 目标实体 + * @return the list of matched entities + * + * @throws SelectorSyntaxException if there is a syntax error in the selector token */ List matchEntities(CommandSender sender, String token) throws SelectorSyntaxException; /** - * 检查给定文本是否是合法目标选择器 + * Checks if the given token is a valid target selector. * - * @param token 给定文本 + * @param token the token to check * - * @return 是否是合法目标选择器 + * @return true if the token is a valid target selector, false otherwise */ boolean checkValid(String token); /** - * 注册一个选择器参数 + * Registers a selector argument. * - * @param argument 选择器参数对象 + * @param argument the selector argument to register * - * @return 是否注册成功(若已存在相同key值的选择器参数则注册失败,返回false) + * @return true if registration is successful (returns false if an argument with the same key already exists) */ boolean registerArgument(SelectorArgument argument); } diff --git a/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorSyntaxException.java b/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorSyntaxException.java index 392093409..e8a7462bc 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorSyntaxException.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorSyntaxException.java @@ -1,10 +1,6 @@ package org.allaymc.api.command.selector; - public class SelectorSyntaxException extends Exception { - - public SelectorSyntaxException() {} - public SelectorSyntaxException(String message) { super(message); } @@ -26,7 +22,7 @@ public String getMessage() { var builder = new StringBuilder(super.getMessage()); Throwable t = this; while (t.getCause() != null) { - //到达最底层 + // Reached the bottom level t = t.getCause(); builder.append("\n"); builder.append("§cCaused by "); diff --git a/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorType.java b/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorType.java index ccf40b401..8ec3724bc 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorType.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/selector/SelectorType.java @@ -1,27 +1,25 @@ package org.allaymc.api.command.selector; +import lombok.AllArgsConstructor; import lombok.Getter; /** - * 所有可能的选择器类型 + * All possible selector types */ +@Getter +@AllArgsConstructor public enum SelectorType { ALL_PLAYERS("a"), ALL_ENTITIES("e"), - //可通过指定type选择随机非玩家实体 - //https://zh.minecraft.wiki/w/%E7%9B%AE%E6%A0%87%E9%80%89%E6%8B%A9%E5%99%A8 + // Can choose random non-player entities by specifying type + // https://zh.minecraft.wiki/w/%E7%9B%AE%E6%A0%87%E9%80%89%E6%8B%A9%E5%99%A8 RANDOM_PLAYER("r"), SELF("s"), NEAREST_PLAYER("p"), NPC_INITIATOR("initiator"); - @Getter private final String token; - SelectorType(String token) { - this.token = token; - } - public static SelectorType parseSelectorType(String type) throws SelectorSyntaxException { return switch (type) { case "a" -> SelectorType.ALL_PLAYERS; @@ -33,5 +31,4 @@ public static SelectorType parseSelectorType(String type) throws SelectorSyntaxE default -> throw new SelectorSyntaxException("Unknown selector type: " + type); }; } - } diff --git a/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedFilterSelectorArgument.java b/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedFilterSelectorArgument.java index 201972c6e..74bc87d96 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedFilterSelectorArgument.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedFilterSelectorArgument.java @@ -15,15 +15,12 @@ import java.util.function.Function; /** - * 与{@link CachedSimpleSelectorArgument}类似,但是适用于过滤器模式。此处不做过多解释

+ * Similar to {@link CachedSimpleSelectorArgument}, but designed for filter mode. No further explanation is provided here.

* * @see CachedSimpleSelectorArgument */ - - public abstract class CachedFilterSelectorArgument implements SelectorArgument { - - Cache, Function, List>> cache; + private final Cache, Function, List>> cache; public CachedFilterSelectorArgument() { this.cache = provideCacheService(); @@ -45,13 +42,14 @@ public boolean isFilter() { } /** - * 当未在缓存中找到解析结果时,则调用此方法对参数进行解析 + * Called when parsing the parameters if the parsing result is not found in the cache */ protected abstract Function, List> cache(SelectorType selectorType, CommandSender sender, Location3fc basePos, String... arguments) throws SelectorSyntaxException; /** - * 初始化缓存时调用此方法

- * 若需要自己的缓存实现,则可覆写此方法 + * Called when initializing the cache + *

+ * Override this method if you need your own cache implementation * * @return {@code Cache, Function, List>>} */ diff --git a/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedSimpleSelectorArgument.java b/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedSimpleSelectorArgument.java index 73c856b9f..f9d3a1b78 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedSimpleSelectorArgument.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/selector/args/CachedSimpleSelectorArgument.java @@ -15,14 +15,12 @@ import java.util.function.Predicate; /** - * 可缓存的目标选择器参数基类

- * 若一个选择器的参数返回的{@code List>}不具有时效性,则可继承此类实现对解析结果的缓存,提高性能 + * Cachable base class for target selector arguments + *

+ * If a selector argument returns {@code List>} without expiration, you can inherit from this class to cache the parsing results for better performance. */ - - public abstract class CachedSimpleSelectorArgument implements SelectorArgument { - - Cache, Predicate> cache; + private final Cache, Predicate> cache; public CachedSimpleSelectorArgument() { this.cache = provideCacheService(); @@ -39,13 +37,14 @@ public Predicate getPredicate(SelectorType selectorType, CommandSender s } /** - * 当未在缓存中找到解析结果时,则调用此方法对参数进行解析 + * Called when parsing the parameters if the parsing result is not found in the cache */ protected abstract Predicate cache(SelectorType selectorType, CommandSender sender, Location3fc basePos, String... arguments) throws SelectorSyntaxException; /** - * 初始化缓存时调用此方法

- * 若需要自己的缓存实现,则可覆写此方法 + * Called when initializing the cache + *

+ * Override this method if you need your own cache implementation * * @return {@code Cache, Predicate>} */ diff --git a/Allay-API/src/main/java/org/allaymc/api/command/selector/args/SelectorArgument.java b/Allay-API/src/main/java/org/allaymc/api/command/selector/args/SelectorArgument.java index 11ac01c38..53966c074 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/selector/args/SelectorArgument.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/selector/args/SelectorArgument.java @@ -15,24 +15,24 @@ import java.util.function.Predicate; /** - * 此接口描述了一个选择器参数

+ * This interface describes a selector argument. */ - - public interface SelectorArgument extends Comparable { /** - * 根据给定的参数表返回特定的{@code List>} + * Returns a specific {@code List>} based on the given arguments table. * - * @param arguments 参数列表 - * @param selectorType 选择器类型 - * @param sender 命令发送者 - * @param basePos 若此参数解析需要用到相对坐标,则应该以此坐标为依据

- * 若此参数需要修改参照坐标(例如x,y,z参数),则应当在这个参数上修改

- * 在一条解析链上的参数只会使用一个Location对象 + * @param arguments the arguments list + * @param selectorType the selector type + * @param sender the command sender + * @param basePos if this argument parsing requires relative coordinates, it should be based on this coordinate. + *

+ * If this parameter needs to modify the reference coordinates (such as x, y, z parameters), it should be modified on this parameter. + *

+ * Only one Location object will be used on a parsing chain. * * @return {@code Predicate} * - * @throws SelectorSyntaxException 当解析出错 + * @throws SelectorSyntaxException when parsing error occurs */ @Nullable default Predicate getPredicate(SelectorType selectorType, CommandSender sender, Location3f basePos, String... arguments) throws SelectorSyntaxException { @@ -40,59 +40,66 @@ default Predicate getPredicate(SelectorType selectorType, CommandSender } /** - * 仅当方法isFilter()返回true时调用此方法

- * 方法返回的实体集合将传递到下一个参数 + * This method is called only when {@code isFilter()} method returns true. + *

+ * The entity collection returned by this method will be passed to the next parameter. * - * @param arguments 参数列表 - * @param selectorType 选择器类型 - * @param sender 命令发送者 - * @param basePos 若此参数解析需要用到相对坐标,则应该以此坐标为依据

- * 若此参数需要修改参照坐标(例如x,y,z参数),则应当在这个参数上修改

- * 在一条解析链上的参数只会使用一个Location对象 + * @param arguments the arguments list + * @param selectorType the selector type + * @param sender the command sender + * @param basePos if this argument parsing requires relative coordinates, it should be based on this coordinate. + *

+ * If this parameter needs to modify the reference coordinates (such as x, y, z parameters), it should be modified on this parameter. + *

+ * Only one Location object will be used on a parsing chain. * - * @return 实体过滤器 + * @return entity filter * - * @throws SelectorSyntaxException 当解析出错 + * @throws SelectorSyntaxException when parsing error occurs */ default Function, List> getFilter(SelectorType selectorType, CommandSender sender, Location3fc basePos, String... arguments) throws SelectorSyntaxException { return null; } /** - * 获取此参数的名称 + * Gets the name of this argument. * - * @return 参数名称 + * @return argument name */ String getKeyName(); /** - * 解析优先级定义了各个参数的解析顺序

- * 优先级越高(数字越小)的参数,其越先被解析,且其解析结果将会影响下个参数的解析 + * Parsing priority defines the parsing order of each parameter. + *

+ * The higher the priority (the smaller the number), the earlier the parameter is parsed, and its parsing result will affect the parsing of the next parameter. * - * @return 此参数的解析优先级 + * @return the parsing priority of this argument */ int getPriority(); /** - * 是否启用过滤器模式

- * 若一个参数为过滤器模式,解析器将不会调用getPredicate()方法而是调用filter()方法

- * 这意味着参数将对到达此参数节点的所有实体进行检测,而不是相对于单个实体进行检测

- * 对于部分参数(例如"c"),需要启用此功能 + * Whether filter mode is enabled. + *

+ * If a parameter is in filter mode, the parser will not call {@code getPredicate()} method but {@code filter()} method instead. + *

+ * This means the parameter will check all entities reaching this parameter node instead of relative to a single entity. + *

+ * For some parameters (e.g., "c"), this feature needs to be enabled. * - * @return 是否启用过滤器模式 + * @return whether filter mode is enabled */ default boolean isFilter() { return false; } /** - * 若一个参数有默认值(即此方法返回非null值),则在解析时若给定参数表中没有此参数,会以此默认值参与解析 + * If a parameter has a default value (i.e., this method returns a non-null value), it will participate in parsing if this parameter is not present in the given argument table. * - * @param values 参数列表 - * @param selectorType 选择器类型 - * @param sender 命令执行者 + * @param values the argument map + * @param selectorType the selector type + * @param sender the command executor * - * @return 此参数的默认值 + * @return the default value of this argument */ @Nullable default String getDefaultValue(Map> values, SelectorType selectorType, CommandSender sender) { diff --git a/Allay-API/src/main/java/org/allaymc/api/command/tree/BaseNode.java b/Allay-API/src/main/java/org/allaymc/api/command/tree/BaseNode.java index cad09d923..a74b04bae 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/tree/BaseNode.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/tree/BaseNode.java @@ -70,17 +70,17 @@ public boolean isOptional() { @Override public CommandNode optional() { - // 无需重复设置 + // No need to set again if already optional if (optional) return this; - //一个节点下只能有一个可选参数 + // A node can only have one optional leaf if (parent.getOptionalLeaf() != null) { throw new IllegalArgumentException("A node can only have one optional leaf node"); } this.optional = true; parent.setOptionalLeaf(this); - // 若节点是可选的,则最小参数消耗为0,否则为1(不允许非可选节点不消耗参数) + // If the node is optional, minimum argument cost is 0, otherwise it's 1 setMinArgCostBranch(optional ? 0 : 1); - // 更新分支最小参数消耗(optional不影响最大参数消耗) + // Update minimum argument cost for branches (optional does not affect maximum argument cost) updateMinArgCostBranch(this); return this; } @@ -129,7 +129,7 @@ public CommandNode nextNode(CommandContext context) { } else { var optionalLeaf = getOptionalLeaf(); if (optionalLeaf != null) { - // 忽略RootNode,所以说索引为optionalLeaf.depth() - 1 + // Ignore RootNode, so the index is optionalLeaf.depth() - 1 context.putResult(optionalLeaf.getDefaultValue()); return optionalLeaf; } @@ -155,8 +155,8 @@ public CommandNode addLeaf(CommandNode leaf) { leaf.setDepth(depth + 1); leaf.setMaxArgCostBranch(leaf.getMaxArgCost()); updateMaxArgCostBranch(leaf); - // 可选参数后不能有非可选参数 - // 分支最小参数消耗在optional()中更新 + // Optional parameters cannot be followed by non-optional parameters + // Minimum argument cost for branches is updated in optional() if (optional) { leaf.optional(); } diff --git a/Allay-API/src/main/java/org/allaymc/api/command/tree/CommandNode.java b/Allay-API/src/main/java/org/allaymc/api/command/tree/CommandNode.java index b8022f8d2..93f9ac397 100644 --- a/Allay-API/src/main/java/org/allaymc/api/command/tree/CommandNode.java +++ b/Allay-API/src/main/java/org/allaymc/api/command/tree/CommandNode.java @@ -30,21 +30,23 @@ public interface CommandNode { Object getDefaultValue(); /** - * @return 选中这个分支后消耗的最小参数数量 + * @return The minimum number of arguments consumed after selecting this branch */ int getMinArgCostBranch(); void setMinArgCostBranch(int minArgCostBranch); /** - * @return 选中这个分支后后消耗的最大参数数量 + * @return The maximum number of arguments consumed after selecting this branch */ int getMaxArgCostBranch(); void setMaxArgCostBranch(int maxArgCostBranch); /** - * @return 这个node最多会消耗几个参数,可以返回一个足够大的数来表示无穷 + * @return The maximum number of arguments this node can consume; + *

+ * return a sufficiently large number to indicate infinity */ default int getMaxArgCost() { return 1; diff --git a/Allay-API/src/main/java/org/allaymc/api/component/annotation/Dependency.java b/Allay-API/src/main/java/org/allaymc/api/component/annotation/Dependency.java index c4a8be332..ae1874b63 100644 --- a/Allay-API/src/main/java/org/allaymc/api/component/annotation/Dependency.java +++ b/Allay-API/src/main/java/org/allaymc/api/component/annotation/Dependency.java @@ -8,10 +8,14 @@ import java.lang.annotation.Target; /** - * This annotation is used to declare other components that one component depends on
- * This annotation needs to be marked on a field of the component's implementation class
- * When building an object, the injector checks the field list of each component implementation class instance and checks whether the fields are marked by this annotation
- * If so, the injector will try to find the corresponding component instance through inheritance relationships (if identifier is empty) or through identifier (if identifier is not empty), and inject it into the field
+ * This annotation is used to declare other components that one component depends on. + *

+ * This annotation needs to be marked on a field of the component's implementation class. + *

+ * When building an object, the injector checks the field list of each component implementation class instance and checks whether the fields are marked by this annotation. + *

+ * If so, the injector will try to find the corresponding component instance through inheritance relationships (if identifier is empty) or through identifier (if identifier is not empty), and inject it into the field. + *

* The scope of dependency lookup is limited by the list of components provided to the injector, and if the dependency is not found, will throw {@link ComponentInjectException} *

* Allay Project 2023/3/4 diff --git a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/Component.java b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/Component.java index 288260bce..5d12e7709 100644 --- a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/Component.java +++ b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/Component.java @@ -1,13 +1,16 @@ package org.allaymc.api.component.interfaces; +import org.allaymc.api.component.annotation.ComponentIdentifier; import org.allaymc.api.component.annotation.DoNotInject; /** - * Describe the implementation of a component
- * Any component implementation needs to implement this interface, otherwise obviously you can't pass it into the injector
+ * Describe the implementation of a component. *

- * The namespace ID of this component implementation will be used when injecting component dependencies
- * Which should be a 'static' constant annotated with {@link org.allaymc.api.component.annotation.ComponentIdentifier}
+ * Any component implementation needs to implement this interface, otherwise obviously you can't pass it into the injector. + *

+ * The namespace ID of this component implementation will be used when injecting component dependencies. + *

+ * Which should be a 'static' constant annotated with {@link ComponentIdentifier}. *

* Allay Project 2023/3/4 * diff --git a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInitInfo.java b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInitInfo.java index f0bbba1fd..4b78c7d14 100644 --- a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInitInfo.java +++ b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInitInfo.java @@ -9,6 +9,5 @@ public interface ComponentInitInfo { ComponentInitInfo EMPTY = new Empty(); - class Empty implements ComponentInitInfo { - } + class Empty implements ComponentInitInfo {} } diff --git a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInjector.java b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInjector.java index 382d33caa..d9198f390 100644 --- a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInjector.java +++ b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentInjector.java @@ -32,9 +32,11 @@ static ComponentInjector createInjector() { ComponentInjector interfaceClass(Class interfaceClass); /** - * Bind a set of implementations for the injector
- * When the dynamic class is instantiated, the component instance will be obtained from the Provider
- * If there are multiple implementation methods for a method to be injected, they will be executed in the order in the component list

+ * Bind a set of implementations for the injector. + *

+ * When the dynamic class is instantiated, the component instance will be obtained from the Provider. + *

+ * If there are multiple implementation methods for a method to be injected, they will be executed in the order in the component list * and the return value is the return value of the last executed method * * @param providers component providers @@ -46,7 +48,8 @@ static ComponentInjector createInjector() { ComponentInjector useCachedClass(Class cachedClass); /** - * Build the class
+ * Build the class. + *

* Note that we guarantee that the returned class implements the {@link ComponentedObject} interface * * @return the class diff --git a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentProvider.java b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentProvider.java index 73b13059f..07826356a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentProvider.java +++ b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentProvider.java @@ -44,7 +44,6 @@ static

Map> toM } @SneakyThrows - static Identifier findComponentIdentifier(Class clazz) { Identifier identifier = null; while (identifier == null) { @@ -56,7 +55,6 @@ static Identifier findComponentIdentifier(Class clazz) { } @SneakyThrows - static Identifier findComponentIdentifierInCertainClass(Class clazz) { for (var field : clazz.getDeclaredFields()) { if (field.isAnnotationPresent(ComponentIdentifier.class) && Identifier.class == field.getType() && isStatic(field.getModifiers())) { @@ -72,15 +70,14 @@ static Identifier findComponentIdentifierInCertainClass(Class clazz) { Class getComponentClass(); @SneakyThrows - default Identifier findComponentIdentifier() { return findComponentIdentifier(getComponentClass()); } + @Getter @AllArgsConstructor class SimpleComponentProvider implements ComponentProvider { private Function provider; - @Getter private Class componentClass; @Override diff --git a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentedObject.java b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentedObject.java index 0e1e34435..509c3802a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentedObject.java +++ b/Allay-API/src/main/java/org/allaymc/api/component/interfaces/ComponentedObject.java @@ -3,8 +3,9 @@ import java.util.List; /** - * The object which has been built by {@link ComponentInjector}
- * Any class spawned from {@link ComponentInjector} will implement this interface and can be used for judgment + * The object which has been built by {@link ComponentInjector}. + *

+ * Any class spawned from {@link ComponentInjector} will implement this interface and can be used for judgment. *

* Allay Project 2023/3/4 * diff --git a/Allay-API/src/main/java/org/allaymc/api/container/impl/PlayerInventoryContainer.java b/Allay-API/src/main/java/org/allaymc/api/container/impl/PlayerInventoryContainer.java index a8ee8091a..50e0d0928 100644 --- a/Allay-API/src/main/java/org/allaymc/api/container/impl/PlayerInventoryContainer.java +++ b/Allay-API/src/main/java/org/allaymc/api/container/impl/PlayerInventoryContainer.java @@ -3,7 +3,6 @@ import lombok.Getter; import lombok.Setter; import org.allaymc.api.container.BaseContainer; -import org.allaymc.api.container.ContainerViewer; import org.allaymc.api.container.FullContainerType; import org.allaymc.api.entity.interfaces.EntityPlayer; import org.allaymc.api.item.ItemStack; diff --git a/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockPropertyTypes.java b/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockPropertyTypes.java index c5a11ff5c..35226bff8 100644 --- a/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockPropertyTypes.java +++ b/Allay-API/src/main/java/org/allaymc/api/data/VanillaBlockPropertyTypes.java @@ -1,316 +1,280 @@ package org.allaymc.api.data; -import java.util.List; -import org.allaymc.api.block.property.enums.Attachment; -import org.allaymc.api.block.property.enums.BambooLeafSize; -import org.allaymc.api.block.property.enums.BambooStalkThickness; -import org.allaymc.api.block.property.enums.BigDripleafTilt; -import org.allaymc.api.block.property.enums.CauldronLiquid; -import org.allaymc.api.block.property.enums.ChemistryTableType; -import org.allaymc.api.block.property.enums.ChiselType; -import org.allaymc.api.block.property.enums.CrackedState; -import org.allaymc.api.block.property.enums.Damage; -import org.allaymc.api.block.property.enums.DirtType; -import org.allaymc.api.block.property.enums.DripstoneThickness; -import org.allaymc.api.block.property.enums.LeverDirection; -import org.allaymc.api.block.property.enums.MinecraftBlockFace; -import org.allaymc.api.block.property.enums.MinecraftCardinalDirection; -import org.allaymc.api.block.property.enums.MinecraftFacingDirection; -import org.allaymc.api.block.property.enums.MinecraftVerticalHalf; -import org.allaymc.api.block.property.enums.MonsterEggStoneType; -import org.allaymc.api.block.property.enums.Orientation; -import org.allaymc.api.block.property.enums.PillarAxis; -import org.allaymc.api.block.property.enums.PortalAxis; -import org.allaymc.api.block.property.enums.PrismarineBlockType; -import org.allaymc.api.block.property.enums.SandStoneType; -import org.allaymc.api.block.property.enums.SandType; -import org.allaymc.api.block.property.enums.SeaGrassType; -import org.allaymc.api.block.property.enums.SpongeType; -import org.allaymc.api.block.property.enums.StoneBrickType; -import org.allaymc.api.block.property.enums.StoneSlabType; -import org.allaymc.api.block.property.enums.StoneSlabType2; -import org.allaymc.api.block.property.enums.StoneSlabType3; -import org.allaymc.api.block.property.enums.StoneSlabType4; -import org.allaymc.api.block.property.enums.StructureBlockType; -import org.allaymc.api.block.property.enums.StructureVoidType; -import org.allaymc.api.block.property.enums.TorchFacingDirection; -import org.allaymc.api.block.property.enums.TurtleEggCount; -import org.allaymc.api.block.property.enums.VaultState; -import org.allaymc.api.block.property.enums.WallBlockType; -import org.allaymc.api.block.property.enums.WallConnectionTypeEast; -import org.allaymc.api.block.property.enums.WallConnectionTypeNorth; -import org.allaymc.api.block.property.enums.WallConnectionTypeSouth; -import org.allaymc.api.block.property.enums.WallConnectionTypeWest; +import org.allaymc.api.block.property.enums.*; import org.allaymc.api.block.property.type.BlockPropertyType; import org.allaymc.api.block.property.type.BooleanPropertyType; import org.allaymc.api.block.property.type.EnumPropertyType; import org.allaymc.api.block.property.type.IntPropertyType; +import java.util.List; + /** - * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen}
- * Allay Project

+ * Automatically generated by {@code org.allaymc.codegen.VanillaBlockPropertyTypeGen} + *

+ * Allay Project + * * @author daoge_cmd */ public interface VanillaBlockPropertyTypes { - BooleanPropertyType ACTIVE = BooleanPropertyType.of("active", false); + BooleanPropertyType ACTIVE = BooleanPropertyType.of("active", false); - IntPropertyType AGE_16 = IntPropertyType.of("age", 0, 15, 0); + IntPropertyType AGE_16 = IntPropertyType.of("age", 0, 15, 0); - IntPropertyType AGE_3 = IntPropertyType.of("age", 0, 2, 0); + IntPropertyType AGE_3 = IntPropertyType.of("age", 0, 2, 0); - IntPropertyType AGE_4 = IntPropertyType.of("age", 0, 3, 0); + IntPropertyType AGE_4 = IntPropertyType.of("age", 0, 3, 0); - IntPropertyType AGE_6 = IntPropertyType.of("age", 0, 5, 0); + IntPropertyType AGE_6 = IntPropertyType.of("age", 0, 5, 0); - BooleanPropertyType AGE_BIT = BooleanPropertyType.of("age_bit", false); + BooleanPropertyType AGE_BIT = BooleanPropertyType.of("age_bit", false); - BooleanPropertyType ALLOW_UNDERWATER_BIT = BooleanPropertyType.of("allow_underwater_bit", false); + BooleanPropertyType ALLOW_UNDERWATER_BIT = BooleanPropertyType.of("allow_underwater_bit", false); - BooleanPropertyType ATTACHED_BIT = BooleanPropertyType.of("attached_bit", false); + BooleanPropertyType ATTACHED_BIT = BooleanPropertyType.of("attached_bit", false); - EnumPropertyType ATTACHMENT = EnumPropertyType.of("attachment" ,Attachment.class ,Attachment.values()[0]); + EnumPropertyType ATTACHMENT = EnumPropertyType.of("attachment", Attachment.class, Attachment.values()[0]); - EnumPropertyType BAMBOO_LEAF_SIZE = EnumPropertyType.of("bamboo_leaf_size" ,BambooLeafSize.class ,BambooLeafSize.values()[0]); + EnumPropertyType BAMBOO_LEAF_SIZE = EnumPropertyType.of("bamboo_leaf_size", BambooLeafSize.class, BambooLeafSize.values()[0]); - EnumPropertyType BAMBOO_STALK_THICKNESS = EnumPropertyType.of("bamboo_stalk_thickness" ,BambooStalkThickness.class ,BambooStalkThickness.values()[0]); + EnumPropertyType BAMBOO_STALK_THICKNESS = EnumPropertyType.of("bamboo_stalk_thickness", BambooStalkThickness.class, BambooStalkThickness.values()[0]); - BooleanPropertyType BIG_DRIPLEAF_HEAD = BooleanPropertyType.of("big_dripleaf_head", false); + BooleanPropertyType BIG_DRIPLEAF_HEAD = BooleanPropertyType.of("big_dripleaf_head", false); - EnumPropertyType BIG_DRIPLEAF_TILT = EnumPropertyType.of("big_dripleaf_tilt" ,BigDripleafTilt.class ,BigDripleafTilt.values()[0]); + EnumPropertyType BIG_DRIPLEAF_TILT = EnumPropertyType.of("big_dripleaf_tilt", BigDripleafTilt.class, BigDripleafTilt.values()[0]); - IntPropertyType BITE_COUNTER = IntPropertyType.of("bite_counter", 0, 6, 0); + IntPropertyType BITE_COUNTER = IntPropertyType.of("bite_counter", 0, 6, 0); - IntPropertyType BLOCK_LIGHT_LEVEL = IntPropertyType.of("block_light_level", 0, 15, 0); + IntPropertyType BLOCK_LIGHT_LEVEL = IntPropertyType.of("block_light_level", 0, 15, 0); - BooleanPropertyType BLOOM = BooleanPropertyType.of("bloom", false); + BooleanPropertyType BLOOM = BooleanPropertyType.of("bloom", false); - IntPropertyType BOOKS_STORED = IntPropertyType.of("books_stored", 0, 63, 0); + IntPropertyType BOOKS_STORED = IntPropertyType.of("books_stored", 0, 63, 0); - BooleanPropertyType BREWING_STAND_SLOT_A_BIT = BooleanPropertyType.of("brewing_stand_slot_a_bit", false); + BooleanPropertyType BREWING_STAND_SLOT_A_BIT = BooleanPropertyType.of("brewing_stand_slot_a_bit", false); - BooleanPropertyType BREWING_STAND_SLOT_B_BIT = BooleanPropertyType.of("brewing_stand_slot_b_bit", false); + BooleanPropertyType BREWING_STAND_SLOT_B_BIT = BooleanPropertyType.of("brewing_stand_slot_b_bit", false); - BooleanPropertyType BREWING_STAND_SLOT_C_BIT = BooleanPropertyType.of("brewing_stand_slot_c_bit", false); + BooleanPropertyType BREWING_STAND_SLOT_C_BIT = BooleanPropertyType.of("brewing_stand_slot_c_bit", false); - IntPropertyType BRUSHED_PROGRESS = IntPropertyType.of("brushed_progress", 0, 3, 0); + IntPropertyType BRUSHED_PROGRESS = IntPropertyType.of("brushed_progress", 0, 3, 0); - BooleanPropertyType BUTTON_PRESSED_BIT = BooleanPropertyType.of("button_pressed_bit", false); + BooleanPropertyType BUTTON_PRESSED_BIT = BooleanPropertyType.of("button_pressed_bit", false); - BooleanPropertyType CAN_SUMMON = BooleanPropertyType.of("can_summon", false); + BooleanPropertyType CAN_SUMMON = BooleanPropertyType.of("can_summon", false); - IntPropertyType CANDLES = IntPropertyType.of("candles", 0, 3, 0); + IntPropertyType CANDLES = IntPropertyType.of("candles", 0, 3, 0); - EnumPropertyType CAULDRON_LIQUID = EnumPropertyType.of("cauldron_liquid" ,CauldronLiquid.class ,CauldronLiquid.values()[0]); + EnumPropertyType CAULDRON_LIQUID = EnumPropertyType.of("cauldron_liquid", CauldronLiquid.class, CauldronLiquid.values()[0]); - EnumPropertyType CHEMISTRY_TABLE_TYPE = EnumPropertyType.of("chemistry_table_type" ,ChemistryTableType.class ,ChemistryTableType.values()[0]); + EnumPropertyType CHEMISTRY_TABLE_TYPE = EnumPropertyType.of("chemistry_table_type", ChemistryTableType.class, ChemistryTableType.values()[0]); - EnumPropertyType CHISEL_TYPE = EnumPropertyType.of("chisel_type" ,ChiselType.class ,ChiselType.values()[0]); + EnumPropertyType CHISEL_TYPE = EnumPropertyType.of("chisel_type", ChiselType.class, ChiselType.values()[0]); - IntPropertyType CLUSTER_COUNT = IntPropertyType.of("cluster_count", 0, 3, 0); + IntPropertyType CLUSTER_COUNT = IntPropertyType.of("cluster_count", 0, 3, 0); - BooleanPropertyType COLOR_BIT = BooleanPropertyType.of("color_bit", false); + BooleanPropertyType COLOR_BIT = BooleanPropertyType.of("color_bit", false); - IntPropertyType COMPOSTER_FILL_LEVEL = IntPropertyType.of("composter_fill_level", 0, 8, 0); + IntPropertyType COMPOSTER_FILL_LEVEL = IntPropertyType.of("composter_fill_level", 0, 8, 0); - BooleanPropertyType CONDITIONAL_BIT = BooleanPropertyType.of("conditional_bit", false); + BooleanPropertyType CONDITIONAL_BIT = BooleanPropertyType.of("conditional_bit", false); - IntPropertyType CORAL_DIRECTION = IntPropertyType.of("coral_direction", 0, 3, 0); + IntPropertyType CORAL_DIRECTION = IntPropertyType.of("coral_direction", 0, 3, 0); - IntPropertyType CORAL_FAN_DIRECTION = IntPropertyType.of("coral_fan_direction", 0, 1, 0); + IntPropertyType CORAL_FAN_DIRECTION = IntPropertyType.of("coral_fan_direction", 0, 1, 0); - BooleanPropertyType CORAL_HANG_TYPE_BIT = BooleanPropertyType.of("coral_hang_type_bit", false); + BooleanPropertyType CORAL_HANG_TYPE_BIT = BooleanPropertyType.of("coral_hang_type_bit", false); - BooleanPropertyType COVERED_BIT = BooleanPropertyType.of("covered_bit", false); + BooleanPropertyType COVERED_BIT = BooleanPropertyType.of("covered_bit", false); - EnumPropertyType CRACKED_STATE = EnumPropertyType.of("cracked_state" ,CrackedState.class ,CrackedState.values()[0]); + EnumPropertyType CRACKED_STATE = EnumPropertyType.of("cracked_state", CrackedState.class, CrackedState.values()[0]); - BooleanPropertyType CRAFTING = BooleanPropertyType.of("crafting", false); + BooleanPropertyType CRAFTING = BooleanPropertyType.of("crafting", false); - EnumPropertyType DAMAGE = EnumPropertyType.of("damage" ,Damage.class ,Damage.values()[0]); + EnumPropertyType DAMAGE = EnumPropertyType.of("damage", Damage.class, Damage.values()[0]); - BooleanPropertyType DEAD_BIT = BooleanPropertyType.of("dead_bit", false); + BooleanPropertyType DEAD_BIT = BooleanPropertyType.of("dead_bit", false); - IntPropertyType DEPRECATED = IntPropertyType.of("deprecated", 0, 3, 0); + IntPropertyType DEPRECATED = IntPropertyType.of("deprecated", 0, 3, 0); - IntPropertyType DIRECTION = IntPropertyType.of("direction", 0, 3, 0); + IntPropertyType DIRECTION = IntPropertyType.of("direction", 0, 3, 0); - EnumPropertyType DIRT_TYPE = EnumPropertyType.of("dirt_type" ,DirtType.class ,DirtType.values()[0]); + EnumPropertyType DIRT_TYPE = EnumPropertyType.of("dirt_type", DirtType.class, DirtType.values()[0]); - BooleanPropertyType DISARMED_BIT = BooleanPropertyType.of("disarmed_bit", false); + BooleanPropertyType DISARMED_BIT = BooleanPropertyType.of("disarmed_bit", false); - BooleanPropertyType DOOR_HINGE_BIT = BooleanPropertyType.of("door_hinge_bit", false); + BooleanPropertyType DOOR_HINGE_BIT = BooleanPropertyType.of("door_hinge_bit", false); - BooleanPropertyType DRAG_DOWN = BooleanPropertyType.of("drag_down", false); + BooleanPropertyType DRAG_DOWN = BooleanPropertyType.of("drag_down", false); - EnumPropertyType DRIPSTONE_THICKNESS = EnumPropertyType.of("dripstone_thickness" ,DripstoneThickness.class ,DripstoneThickness.values()[0]); + EnumPropertyType DRIPSTONE_THICKNESS = EnumPropertyType.of("dripstone_thickness", DripstoneThickness.class, DripstoneThickness.values()[0]); - BooleanPropertyType END_PORTAL_EYE_BIT = BooleanPropertyType.of("end_portal_eye_bit", false); + BooleanPropertyType END_PORTAL_EYE_BIT = BooleanPropertyType.of("end_portal_eye_bit", false); - BooleanPropertyType EXPLODE_BIT = BooleanPropertyType.of("explode_bit", false); + BooleanPropertyType EXPLODE_BIT = BooleanPropertyType.of("explode_bit", false); - BooleanPropertyType EXTINGUISHED = BooleanPropertyType.of("extinguished", false); + BooleanPropertyType EXTINGUISHED = BooleanPropertyType.of("extinguished", false); - IntPropertyType FACING_DIRECTION = IntPropertyType.of("facing_direction", 0, 5, 0); + IntPropertyType FACING_DIRECTION = IntPropertyType.of("facing_direction", 0, 5, 0); - IntPropertyType FILL_LEVEL = IntPropertyType.of("fill_level", 0, 6, 0); + IntPropertyType FILL_LEVEL = IntPropertyType.of("fill_level", 0, 6, 0); - IntPropertyType GROUND_SIGN_DIRECTION = IntPropertyType.of("ground_sign_direction", 0, 15, 0); + IntPropertyType GROUND_SIGN_DIRECTION = IntPropertyType.of("ground_sign_direction", 0, 15, 0); - IntPropertyType GROWING_PLANT_AGE = IntPropertyType.of("growing_plant_age", 0, 25, 0); + IntPropertyType GROWING_PLANT_AGE = IntPropertyType.of("growing_plant_age", 0, 25, 0); - IntPropertyType GROWTH = IntPropertyType.of("growth", 0, 7, 0); + IntPropertyType GROWTH = IntPropertyType.of("growth", 0, 7, 0); - BooleanPropertyType HANGING = BooleanPropertyType.of("hanging", false); + BooleanPropertyType HANGING = BooleanPropertyType.of("hanging", false); - BooleanPropertyType HEAD_PIECE_BIT = BooleanPropertyType.of("head_piece_bit", false); + BooleanPropertyType HEAD_PIECE_BIT = BooleanPropertyType.of("head_piece_bit", false); - IntPropertyType HEIGHT = IntPropertyType.of("height", 0, 7, 0); + IntPropertyType HEIGHT = IntPropertyType.of("height", 0, 7, 0); - IntPropertyType HONEY_LEVEL = IntPropertyType.of("honey_level", 0, 5, 0); + IntPropertyType HONEY_LEVEL = IntPropertyType.of("honey_level", 0, 5, 0); - IntPropertyType HUGE_MUSHROOM_BITS = IntPropertyType.of("huge_mushroom_bits", 0, 15, 0); + IntPropertyType HUGE_MUSHROOM_BITS = IntPropertyType.of("huge_mushroom_bits", 0, 15, 0); - BooleanPropertyType IN_WALL_BIT = BooleanPropertyType.of("in_wall_bit", false); + BooleanPropertyType IN_WALL_BIT = BooleanPropertyType.of("in_wall_bit", false); - BooleanPropertyType INFINIBURN_BIT = BooleanPropertyType.of("infiniburn_bit", false); + BooleanPropertyType INFINIBURN_BIT = BooleanPropertyType.of("infiniburn_bit", false); - BooleanPropertyType ITEM_FRAME_MAP_BIT = BooleanPropertyType.of("item_frame_map_bit", false); + BooleanPropertyType ITEM_FRAME_MAP_BIT = BooleanPropertyType.of("item_frame_map_bit", false); - BooleanPropertyType ITEM_FRAME_PHOTO_BIT = BooleanPropertyType.of("item_frame_photo_bit", false); + BooleanPropertyType ITEM_FRAME_PHOTO_BIT = BooleanPropertyType.of("item_frame_photo_bit", false); - IntPropertyType KELP_AGE = IntPropertyType.of("kelp_age", 0, 25, 0); + IntPropertyType KELP_AGE = IntPropertyType.of("kelp_age", 0, 25, 0); - EnumPropertyType LEVER_DIRECTION = EnumPropertyType.of("lever_direction" ,LeverDirection.class ,LeverDirection.values()[0]); + EnumPropertyType LEVER_DIRECTION = EnumPropertyType.of("lever_direction", LeverDirection.class, LeverDirection.values()[0]); - IntPropertyType LIQUID_DEPTH = IntPropertyType.of("liquid_depth", 0, 15, 0); + IntPropertyType LIQUID_DEPTH = IntPropertyType.of("liquid_depth", 0, 15, 0); - BooleanPropertyType LIT = BooleanPropertyType.of("lit", false); + BooleanPropertyType LIT = BooleanPropertyType.of("lit", false); - EnumPropertyType MINECRAFT_BLOCK_FACE = EnumPropertyType.of("minecraft:block_face" ,MinecraftBlockFace.class ,MinecraftBlockFace.values()[0]); + EnumPropertyType MINECRAFT_BLOCK_FACE = EnumPropertyType.of("minecraft:block_face", MinecraftBlockFace.class, MinecraftBlockFace.values()[0]); - EnumPropertyType MINECRAFT_CARDINAL_DIRECTION = EnumPropertyType.of("minecraft:cardinal_direction" ,MinecraftCardinalDirection.class ,MinecraftCardinalDirection.values()[0]); + EnumPropertyType MINECRAFT_CARDINAL_DIRECTION = EnumPropertyType.of("minecraft:cardinal_direction", MinecraftCardinalDirection.class, MinecraftCardinalDirection.values()[0]); - EnumPropertyType MINECRAFT_FACING_DIRECTION = EnumPropertyType.of("minecraft:facing_direction" ,MinecraftFacingDirection.class ,MinecraftFacingDirection.values()[0]); + EnumPropertyType MINECRAFT_FACING_DIRECTION = EnumPropertyType.of("minecraft:facing_direction", MinecraftFacingDirection.class, MinecraftFacingDirection.values()[0]); - EnumPropertyType MINECRAFT_VERTICAL_HALF = EnumPropertyType.of("minecraft:vertical_half" ,MinecraftVerticalHalf.class ,MinecraftVerticalHalf.values()[0]); + EnumPropertyType MINECRAFT_VERTICAL_HALF = EnumPropertyType.of("minecraft:vertical_half", MinecraftVerticalHalf.class, MinecraftVerticalHalf.values()[0]); - IntPropertyType MOISTURIZED_AMOUNT = IntPropertyType.of("moisturized_amount", 0, 7, 0); + IntPropertyType MOISTURIZED_AMOUNT = IntPropertyType.of("moisturized_amount", 0, 7, 0); - EnumPropertyType MONSTER_EGG_STONE_TYPE = EnumPropertyType.of("monster_egg_stone_type" ,MonsterEggStoneType.class ,MonsterEggStoneType.values()[0]); + EnumPropertyType MONSTER_EGG_STONE_TYPE = EnumPropertyType.of("monster_egg_stone_type", MonsterEggStoneType.class, MonsterEggStoneType.values()[0]); - IntPropertyType MULTI_FACE_DIRECTION_BITS = IntPropertyType.of("multi_face_direction_bits", 0, 63, 0); + IntPropertyType MULTI_FACE_DIRECTION_BITS = IntPropertyType.of("multi_face_direction_bits", 0, 63, 0); - BooleanPropertyType OCCUPIED_BIT = BooleanPropertyType.of("occupied_bit", false); + BooleanPropertyType OCCUPIED_BIT = BooleanPropertyType.of("occupied_bit", false); - BooleanPropertyType OMINOUS = BooleanPropertyType.of("ominous", false); + BooleanPropertyType OMINOUS = BooleanPropertyType.of("ominous", false); - BooleanPropertyType OPEN_BIT = BooleanPropertyType.of("open_bit", false); + BooleanPropertyType OPEN_BIT = BooleanPropertyType.of("open_bit", false); - EnumPropertyType ORIENTATION = EnumPropertyType.of("orientation" ,Orientation.class ,Orientation.values()[0]); + EnumPropertyType ORIENTATION = EnumPropertyType.of("orientation", Orientation.class, Orientation.values()[0]); - BooleanPropertyType OUTPUT_LIT_BIT = BooleanPropertyType.of("output_lit_bit", false); + BooleanPropertyType OUTPUT_LIT_BIT = BooleanPropertyType.of("output_lit_bit", false); - BooleanPropertyType OUTPUT_SUBTRACT_BIT = BooleanPropertyType.of("output_subtract_bit", false); + BooleanPropertyType OUTPUT_SUBTRACT_BIT = BooleanPropertyType.of("output_subtract_bit", false); - BooleanPropertyType PERSISTENT_BIT = BooleanPropertyType.of("persistent_bit", false); + BooleanPropertyType PERSISTENT_BIT = BooleanPropertyType.of("persistent_bit", false); - EnumPropertyType PILLAR_AXIS = EnumPropertyType.of("pillar_axis" ,PillarAxis.class ,PillarAxis.values()[0]); + EnumPropertyType PILLAR_AXIS = EnumPropertyType.of("pillar_axis", PillarAxis.class, PillarAxis.values()[0]); - EnumPropertyType PORTAL_AXIS = EnumPropertyType.of("portal_axis" ,PortalAxis.class ,PortalAxis.values()[0]); + EnumPropertyType PORTAL_AXIS = EnumPropertyType.of("portal_axis", PortalAxis.class, PortalAxis.values()[0]); - BooleanPropertyType POWERED_BIT = BooleanPropertyType.of("powered_bit", false); + BooleanPropertyType POWERED_BIT = BooleanPropertyType.of("powered_bit", false); - EnumPropertyType PRISMARINE_BLOCK_TYPE = EnumPropertyType.of("prismarine_block_type" ,PrismarineBlockType.class ,PrismarineBlockType.values()[0]); + EnumPropertyType PRISMARINE_BLOCK_TYPE = EnumPropertyType.of("prismarine_block_type", PrismarineBlockType.class, PrismarineBlockType.values()[0]); - IntPropertyType PROPAGULE_STAGE = IntPropertyType.of("propagule_stage", 0, 4, 0); + IntPropertyType PROPAGULE_STAGE = IntPropertyType.of("propagule_stage", 0, 4, 0); - BooleanPropertyType RAIL_DATA_BIT = BooleanPropertyType.of("rail_data_bit", false); + BooleanPropertyType RAIL_DATA_BIT = BooleanPropertyType.of("rail_data_bit", false); - IntPropertyType RAIL_DIRECTION_10 = IntPropertyType.of("rail_direction", 0, 9, 0); + IntPropertyType RAIL_DIRECTION_10 = IntPropertyType.of("rail_direction", 0, 9, 0); - IntPropertyType RAIL_DIRECTION_6 = IntPropertyType.of("rail_direction", 0, 5, 0); + IntPropertyType RAIL_DIRECTION_6 = IntPropertyType.of("rail_direction", 0, 5, 0); - IntPropertyType REDSTONE_SIGNAL = IntPropertyType.of("redstone_signal", 0, 15, 0); + IntPropertyType REDSTONE_SIGNAL = IntPropertyType.of("redstone_signal", 0, 15, 0); - IntPropertyType REPEATER_DELAY = IntPropertyType.of("repeater_delay", 0, 3, 0); + IntPropertyType REPEATER_DELAY = IntPropertyType.of("repeater_delay", 0, 3, 0); - IntPropertyType RESPAWN_ANCHOR_CHARGE = IntPropertyType.of("respawn_anchor_charge", 0, 4, 0); + IntPropertyType RESPAWN_ANCHOR_CHARGE = IntPropertyType.of("respawn_anchor_charge", 0, 4, 0); - IntPropertyType ROTATION = IntPropertyType.of("rotation", 0, 3, 0); + IntPropertyType ROTATION = IntPropertyType.of("rotation", 0, 3, 0); - EnumPropertyType SAND_STONE_TYPE = EnumPropertyType.of("sand_stone_type" ,SandStoneType.class ,SandStoneType.values()[0]); + EnumPropertyType SAND_STONE_TYPE = EnumPropertyType.of("sand_stone_type", SandStoneType.class, SandStoneType.values()[0]); - EnumPropertyType SAND_TYPE = EnumPropertyType.of("sand_type" ,SandType.class ,SandType.values()[0]); + EnumPropertyType SAND_TYPE = EnumPropertyType.of("sand_type", SandType.class, SandType.values()[0]); - IntPropertyType SCULK_SENSOR_PHASE = IntPropertyType.of("sculk_sensor_phase", 0, 2, 0); + IntPropertyType SCULK_SENSOR_PHASE = IntPropertyType.of("sculk_sensor_phase", 0, 2, 0); - EnumPropertyType SEA_GRASS_TYPE = EnumPropertyType.of("sea_grass_type" ,SeaGrassType.class ,SeaGrassType.values()[0]); + EnumPropertyType SEA_GRASS_TYPE = EnumPropertyType.of("sea_grass_type", SeaGrassType.class, SeaGrassType.values()[0]); - EnumPropertyType SPONGE_TYPE = EnumPropertyType.of("sponge_type" ,SpongeType.class ,SpongeType.values()[0]); + EnumPropertyType SPONGE_TYPE = EnumPropertyType.of("sponge_type", SpongeType.class, SpongeType.values()[0]); - IntPropertyType STABILITY = IntPropertyType.of("stability", 0, 7, 0); + IntPropertyType STABILITY = IntPropertyType.of("stability", 0, 7, 0); - BooleanPropertyType STABILITY_CHECK = BooleanPropertyType.of("stability_check", false); + BooleanPropertyType STABILITY_CHECK = BooleanPropertyType.of("stability_check", false); - EnumPropertyType STONE_BRICK_TYPE = EnumPropertyType.of("stone_brick_type" ,StoneBrickType.class ,StoneBrickType.values()[0]); + EnumPropertyType STONE_BRICK_TYPE = EnumPropertyType.of("stone_brick_type", StoneBrickType.class, StoneBrickType.values()[0]); - EnumPropertyType STONE_SLAB_TYPE = EnumPropertyType.of("stone_slab_type" ,StoneSlabType.class ,StoneSlabType.values()[0]); + EnumPropertyType STONE_SLAB_TYPE = EnumPropertyType.of("stone_slab_type", StoneSlabType.class, StoneSlabType.values()[0]); - EnumPropertyType STONE_SLAB_TYPE_2 = EnumPropertyType.of("stone_slab_type_2" ,StoneSlabType2.class ,StoneSlabType2.values()[0]); + EnumPropertyType STONE_SLAB_TYPE_2 = EnumPropertyType.of("stone_slab_type_2", StoneSlabType2.class, StoneSlabType2.values()[0]); - EnumPropertyType STONE_SLAB_TYPE_3 = EnumPropertyType.of("stone_slab_type_3" ,StoneSlabType3.class ,StoneSlabType3.values()[0]); + EnumPropertyType STONE_SLAB_TYPE_3 = EnumPropertyType.of("stone_slab_type_3", StoneSlabType3.class, StoneSlabType3.values()[0]); - EnumPropertyType STONE_SLAB_TYPE_4 = EnumPropertyType.of("stone_slab_type_4" ,StoneSlabType4.class ,StoneSlabType4.values()[0]); + EnumPropertyType STONE_SLAB_TYPE_4 = EnumPropertyType.of("stone_slab_type_4", StoneSlabType4.class, StoneSlabType4.values()[0]); - BooleanPropertyType STRIPPED_BIT = BooleanPropertyType.of("stripped_bit", false); + BooleanPropertyType STRIPPED_BIT = BooleanPropertyType.of("stripped_bit", false); - EnumPropertyType STRUCTURE_BLOCK_TYPE = EnumPropertyType.of("structure_block_type" ,StructureBlockType.class ,StructureBlockType.values()[0]); + EnumPropertyType STRUCTURE_BLOCK_TYPE = EnumPropertyType.of("structure_block_type", StructureBlockType.class, StructureBlockType.values()[0]); - EnumPropertyType STRUCTURE_VOID_TYPE = EnumPropertyType.of("structure_void_type" ,StructureVoidType.class ,StructureVoidType.values()[0]); + EnumPropertyType STRUCTURE_VOID_TYPE = EnumPropertyType.of("structure_void_type", StructureVoidType.class, StructureVoidType.values()[0]); - BooleanPropertyType SUSPENDED_BIT = BooleanPropertyType.of("suspended_bit", false); + BooleanPropertyType SUSPENDED_BIT = BooleanPropertyType.of("suspended_bit", false); - BooleanPropertyType TOGGLE_BIT = BooleanPropertyType.of("toggle_bit", false); + BooleanPropertyType TOGGLE_BIT = BooleanPropertyType.of("toggle_bit", false); - EnumPropertyType TORCH_FACING_DIRECTION = EnumPropertyType.of("torch_facing_direction" ,TorchFacingDirection.class ,TorchFacingDirection.values()[0]); + EnumPropertyType TORCH_FACING_DIRECTION = EnumPropertyType.of("torch_facing_direction", TorchFacingDirection.class, TorchFacingDirection.values()[0]); - IntPropertyType TRIAL_SPAWNER_STATE = IntPropertyType.of("trial_spawner_state", 0, 5, 0); + IntPropertyType TRIAL_SPAWNER_STATE = IntPropertyType.of("trial_spawner_state", 0, 5, 0); - BooleanPropertyType TRIGGERED_BIT = BooleanPropertyType.of("triggered_bit", false); + BooleanPropertyType TRIGGERED_BIT = BooleanPropertyType.of("triggered_bit", false); - EnumPropertyType TURTLE_EGG_COUNT = EnumPropertyType.of("turtle_egg_count" ,TurtleEggCount.class ,TurtleEggCount.values()[0]); + EnumPropertyType TURTLE_EGG_COUNT = EnumPropertyType.of("turtle_egg_count", TurtleEggCount.class, TurtleEggCount.values()[0]); - IntPropertyType TWISTING_VINES_AGE = IntPropertyType.of("twisting_vines_age", 0, 25, 0); + IntPropertyType TWISTING_VINES_AGE = IntPropertyType.of("twisting_vines_age", 0, 25, 0); - BooleanPropertyType UPDATE_BIT = BooleanPropertyType.of("update_bit", false); + BooleanPropertyType UPDATE_BIT = BooleanPropertyType.of("update_bit", false); - BooleanPropertyType UPPER_BLOCK_BIT = BooleanPropertyType.of("upper_block_bit", false); + BooleanPropertyType UPPER_BLOCK_BIT = BooleanPropertyType.of("upper_block_bit", false); - BooleanPropertyType UPSIDE_DOWN_BIT = BooleanPropertyType.of("upside_down_bit", false); + BooleanPropertyType UPSIDE_DOWN_BIT = BooleanPropertyType.of("upside_down_bit", false); - EnumPropertyType VAULT_STATE = EnumPropertyType.of("vault_state" ,VaultState.class ,VaultState.values()[0]); + EnumPropertyType VAULT_STATE = EnumPropertyType.of("vault_state", VaultState.class, VaultState.values()[0]); - IntPropertyType VINE_DIRECTION_BITS = IntPropertyType.of("vine_direction_bits", 0, 15, 0); + IntPropertyType VINE_DIRECTION_BITS = IntPropertyType.of("vine_direction_bits", 0, 15, 0); - EnumPropertyType WALL_BLOCK_TYPE = EnumPropertyType.of("wall_block_type" ,WallBlockType.class ,WallBlockType.values()[0]); + EnumPropertyType WALL_BLOCK_TYPE = EnumPropertyType.of("wall_block_type", WallBlockType.class, WallBlockType.values()[0]); - EnumPropertyType WALL_CONNECTION_TYPE_EAST = EnumPropertyType.of("wall_connection_type_east" ,WallConnectionTypeEast.class ,WallConnectionTypeEast.values()[0]); + EnumPropertyType WALL_CONNECTION_TYPE_EAST = EnumPropertyType.of("wall_connection_type_east", WallConnectionTypeEast.class, WallConnectionTypeEast.values()[0]); - EnumPropertyType WALL_CONNECTION_TYPE_NORTH = EnumPropertyType.of("wall_connection_type_north" ,WallConnectionTypeNorth.class ,WallConnectionTypeNorth.values()[0]); + EnumPropertyType WALL_CONNECTION_TYPE_NORTH = EnumPropertyType.of("wall_connection_type_north", WallConnectionTypeNorth.class, WallConnectionTypeNorth.values()[0]); - EnumPropertyType WALL_CONNECTION_TYPE_SOUTH = EnumPropertyType.of("wall_connection_type_south" ,WallConnectionTypeSouth.class ,WallConnectionTypeSouth.values()[0]); + EnumPropertyType WALL_CONNECTION_TYPE_SOUTH = EnumPropertyType.of("wall_connection_type_south", WallConnectionTypeSouth.class, WallConnectionTypeSouth.values()[0]); - EnumPropertyType WALL_CONNECTION_TYPE_WEST = EnumPropertyType.of("wall_connection_type_west" ,WallConnectionTypeWest.class ,WallConnectionTypeWest.values()[0]); + EnumPropertyType WALL_CONNECTION_TYPE_WEST = EnumPropertyType.of("wall_connection_type_west", WallConnectionTypeWest.class, WallConnectionTypeWest.values()[0]); - BooleanPropertyType WALL_POST_BIT = BooleanPropertyType.of("wall_post_bit", false); + BooleanPropertyType WALL_POST_BIT = BooleanPropertyType.of("wall_post_bit", false); - IntPropertyType WEEPING_VINES_AGE = IntPropertyType.of("weeping_vines_age", 0, 25, 0); + IntPropertyType WEEPING_VINES_AGE = IntPropertyType.of("weeping_vines_age", 0, 25, 0); - IntPropertyType WEIRDO_DIRECTION = IntPropertyType.of("weirdo_direction", 0, 3, 0); + IntPropertyType WEIRDO_DIRECTION = IntPropertyType.of("weirdo_direction", 0, 3, 0); - List> VALUES = List.of(ACTIVE, AGE_16, AGE_3, AGE_4, AGE_6, AGE_BIT, ALLOW_UNDERWATER_BIT, ATTACHED_BIT, ATTACHMENT, BAMBOO_LEAF_SIZE, BAMBOO_STALK_THICKNESS, BIG_DRIPLEAF_HEAD, BIG_DRIPLEAF_TILT, BITE_COUNTER, BLOCK_LIGHT_LEVEL, BLOOM, BOOKS_STORED, BREWING_STAND_SLOT_A_BIT, BREWING_STAND_SLOT_B_BIT, BREWING_STAND_SLOT_C_BIT, BRUSHED_PROGRESS, BUTTON_PRESSED_BIT, CAN_SUMMON, CANDLES, CAULDRON_LIQUID, CHEMISTRY_TABLE_TYPE, CHISEL_TYPE, CLUSTER_COUNT, COLOR_BIT, COMPOSTER_FILL_LEVEL, CONDITIONAL_BIT, CORAL_DIRECTION, CORAL_FAN_DIRECTION, CORAL_HANG_TYPE_BIT, COVERED_BIT, CRACKED_STATE, CRAFTING, DAMAGE, DEAD_BIT, DEPRECATED, DIRECTION, DIRT_TYPE, DISARMED_BIT, DOOR_HINGE_BIT, DRAG_DOWN, DRIPSTONE_THICKNESS, END_PORTAL_EYE_BIT, EXPLODE_BIT, EXTINGUISHED, FACING_DIRECTION, FILL_LEVEL, GROUND_SIGN_DIRECTION, GROWING_PLANT_AGE, GROWTH, HANGING, HEAD_PIECE_BIT, HEIGHT, HONEY_LEVEL, HUGE_MUSHROOM_BITS, IN_WALL_BIT, INFINIBURN_BIT, ITEM_FRAME_MAP_BIT, ITEM_FRAME_PHOTO_BIT, KELP_AGE, LEVER_DIRECTION, LIQUID_DEPTH, LIT, MINECRAFT_BLOCK_FACE, MINECRAFT_CARDINAL_DIRECTION, MINECRAFT_FACING_DIRECTION, MINECRAFT_VERTICAL_HALF, MOISTURIZED_AMOUNT, MONSTER_EGG_STONE_TYPE, MULTI_FACE_DIRECTION_BITS, OCCUPIED_BIT, OMINOUS, OPEN_BIT, ORIENTATION, OUTPUT_LIT_BIT, OUTPUT_SUBTRACT_BIT, PERSISTENT_BIT, PILLAR_AXIS, PORTAL_AXIS, POWERED_BIT, PRISMARINE_BLOCK_TYPE, PROPAGULE_STAGE, RAIL_DATA_BIT, RAIL_DIRECTION_10, RAIL_DIRECTION_6, REDSTONE_SIGNAL, REPEATER_DELAY, RESPAWN_ANCHOR_CHARGE, ROTATION, SAND_STONE_TYPE, SAND_TYPE, SCULK_SENSOR_PHASE, SEA_GRASS_TYPE, SPONGE_TYPE, STABILITY, STABILITY_CHECK, STONE_BRICK_TYPE, STONE_SLAB_TYPE, STONE_SLAB_TYPE_2, STONE_SLAB_TYPE_3, STONE_SLAB_TYPE_4, STRIPPED_BIT, STRUCTURE_BLOCK_TYPE, STRUCTURE_VOID_TYPE, SUSPENDED_BIT, TOGGLE_BIT, TORCH_FACING_DIRECTION, TRIAL_SPAWNER_STATE, TRIGGERED_BIT, TURTLE_EGG_COUNT, TWISTING_VINES_AGE, UPDATE_BIT, UPPER_BLOCK_BIT, UPSIDE_DOWN_BIT, VAULT_STATE, VINE_DIRECTION_BITS, WALL_BLOCK_TYPE, WALL_CONNECTION_TYPE_EAST, WALL_CONNECTION_TYPE_NORTH, WALL_CONNECTION_TYPE_SOUTH, WALL_CONNECTION_TYPE_WEST, WALL_POST_BIT, WEEPING_VINES_AGE, WEIRDO_DIRECTION); + List> VALUES = List.of(ACTIVE, AGE_16, AGE_3, AGE_4, AGE_6, AGE_BIT, ALLOW_UNDERWATER_BIT, ATTACHED_BIT, ATTACHMENT, BAMBOO_LEAF_SIZE, BAMBOO_STALK_THICKNESS, BIG_DRIPLEAF_HEAD, BIG_DRIPLEAF_TILT, BITE_COUNTER, BLOCK_LIGHT_LEVEL, BLOOM, BOOKS_STORED, BREWING_STAND_SLOT_A_BIT, BREWING_STAND_SLOT_B_BIT, BREWING_STAND_SLOT_C_BIT, BRUSHED_PROGRESS, BUTTON_PRESSED_BIT, CAN_SUMMON, CANDLES, CAULDRON_LIQUID, CHEMISTRY_TABLE_TYPE, CHISEL_TYPE, CLUSTER_COUNT, COLOR_BIT, COMPOSTER_FILL_LEVEL, CONDITIONAL_BIT, CORAL_DIRECTION, CORAL_FAN_DIRECTION, CORAL_HANG_TYPE_BIT, COVERED_BIT, CRACKED_STATE, CRAFTING, DAMAGE, DEAD_BIT, DEPRECATED, DIRECTION, DIRT_TYPE, DISARMED_BIT, DOOR_HINGE_BIT, DRAG_DOWN, DRIPSTONE_THICKNESS, END_PORTAL_EYE_BIT, EXPLODE_BIT, EXTINGUISHED, FACING_DIRECTION, FILL_LEVEL, GROUND_SIGN_DIRECTION, GROWING_PLANT_AGE, GROWTH, HANGING, HEAD_PIECE_BIT, HEIGHT, HONEY_LEVEL, HUGE_MUSHROOM_BITS, IN_WALL_BIT, INFINIBURN_BIT, ITEM_FRAME_MAP_BIT, ITEM_FRAME_PHOTO_BIT, KELP_AGE, LEVER_DIRECTION, LIQUID_DEPTH, LIT, MINECRAFT_BLOCK_FACE, MINECRAFT_CARDINAL_DIRECTION, MINECRAFT_FACING_DIRECTION, MINECRAFT_VERTICAL_HALF, MOISTURIZED_AMOUNT, MONSTER_EGG_STONE_TYPE, MULTI_FACE_DIRECTION_BITS, OCCUPIED_BIT, OMINOUS, OPEN_BIT, ORIENTATION, OUTPUT_LIT_BIT, OUTPUT_SUBTRACT_BIT, PERSISTENT_BIT, PILLAR_AXIS, PORTAL_AXIS, POWERED_BIT, PRISMARINE_BLOCK_TYPE, PROPAGULE_STAGE, RAIL_DATA_BIT, RAIL_DIRECTION_10, RAIL_DIRECTION_6, REDSTONE_SIGNAL, REPEATER_DELAY, RESPAWN_ANCHOR_CHARGE, ROTATION, SAND_STONE_TYPE, SAND_TYPE, SCULK_SENSOR_PHASE, SEA_GRASS_TYPE, SPONGE_TYPE, STABILITY, STABILITY_CHECK, STONE_BRICK_TYPE, STONE_SLAB_TYPE, STONE_SLAB_TYPE_2, STONE_SLAB_TYPE_3, STONE_SLAB_TYPE_4, STRIPPED_BIT, STRUCTURE_BLOCK_TYPE, STRUCTURE_VOID_TYPE, SUSPENDED_BIT, TOGGLE_BIT, TORCH_FACING_DIRECTION, TRIAL_SPAWNER_STATE, TRIGGERED_BIT, TURTLE_EGG_COUNT, TWISTING_VINES_AGE, UPDATE_BIT, UPPER_BLOCK_BIT, UPSIDE_DOWN_BIT, VAULT_STATE, VINE_DIRECTION_BITS, WALL_BLOCK_TYPE, WALL_CONNECTION_TYPE_EAST, WALL_CONNECTION_TYPE_NORTH, WALL_CONNECTION_TYPE_SOUTH, WALL_CONNECTION_TYPE_WEST, WALL_POST_BIT, WEEPING_VINES_AGE, WEIRDO_DIRECTION); - static List> values() { - return VALUES; - } + static List> values() { + return VALUES; + } } diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/SemVersion.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/SemVersion.java index 5ec76548f..e8d9cceff 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/SemVersion.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/SemVersion.java @@ -6,7 +6,6 @@ import java.lang.reflect.Type; public record SemVersion(int major, int minor, int patch, int revision, int build) { - public static SemVersion from(int[] versions) { if (versions.length == 0) { return new SemVersion(0, 0, 0, 0, 0); diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBOverlapFilter.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBOverlapFilter.java index fb9208ab6..d7fe72607 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBOverlapFilter.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBOverlapFilter.java @@ -9,5 +9,4 @@ */ @FunctionalInterface public interface AABBOverlapFilter extends Predicate { - } diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTree.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTree.java index fabbf73d6..99c03713e 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTree.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTree.java @@ -135,16 +135,16 @@ private AABBTreeNode balanceRight(AABBTreeNode node, AABBTreeNode left, right.assignChild(AABBTreeNode.RIGHT_CHILD, rightLeftChild.getIndex()); node.assignChild(AABBTreeNode.RIGHT_CHILD, rightRightChild.getIndex()); rightRightChild.setParent(node.getIndex()); - left.getAABB().union(rightRightChild.getAABB(), node.getAABB()); - node.getAABB().union(rightLeftChild.getAABB(), right.getAABB()); + left.getAabb().union(rightRightChild.getAabb(), node.getAabb()); + node.getAabb().union(rightLeftChild.getAabb(), right.getAabb()); node.setHeight(1 + max(left.getHeight(), rightRightChild.getHeight())); right.setHeight(1 + max(node.getHeight(), rightLeftChild.getHeight())); } else { right.assignChild(AABBTreeNode.RIGHT_CHILD, rightRightChild.getIndex()); node.assignChild(AABBTreeNode.RIGHT_CHILD, rightLeftChild.getIndex()); rightLeftChild.setParent(node.getIndex()); - left.getAABB().union(rightLeftChild.getAABB(), node.getAABB()); - node.getAABB().union(rightRightChild.getAABB(), right.getAABB()); + left.getAabb().union(rightLeftChild.getAabb(), node.getAabb()); + node.getAabb().union(rightRightChild.getAabb(), right.getAabb()); node.setHeight(1 + max(left.getHeight(), rightLeftChild.getHeight())); right.setHeight(1 + max(node.getHeight(), rightRightChild.getHeight())); } @@ -175,16 +175,16 @@ private AABBTreeNode balanceLeft(AABBTreeNode node, AABBTreeNode left, left.assignChild(AABBTreeNode.RIGHT_CHILD, leftLeftChild.getIndex()); node.assignChild(AABBTreeNode.LEFT_CHILD, leftRightChild.getIndex()); leftRightChild.setParent(node.getIndex()); - right.getAABB().union(leftRightChild.getAABB(), node.getAABB()); - node.getAABB().union(leftLeftChild.getAABB(), left.getAABB()); + right.getAabb().union(leftRightChild.getAabb(), node.getAabb()); + node.getAabb().union(leftLeftChild.getAabb(), left.getAabb()); node.setHeight(1 + max(right.getHeight(), leftRightChild.getHeight())); left.setHeight(1 + max(node.getHeight(), leftLeftChild.getHeight())); } else { left.assignChild(AABBTreeNode.RIGHT_CHILD, leftRightChild.getIndex()); node.assignChild(AABBTreeNode.LEFT_CHILD, leftLeftChild.getIndex()); leftLeftChild.setParent(node.getIndex()); - right.getAABB().union(leftLeftChild.getAABB(), node.getAABB()); - node.getAABB().union(leftRightChild.getAABB(), left.getAABB()); + right.getAabb().union(leftLeftChild.getAabb(), node.getAabb()); + node.getAabb().union(leftRightChild.getAabb(), left.getAabb()); node.setHeight(1 + max(right.getHeight(), leftLeftChild.getHeight())); left.setHeight(1 + max(node.getHeight(), leftRightChild.getHeight())); } @@ -220,7 +220,7 @@ private void syncUpHierarchy(AABBTreeNode startingPoint) { AABBTreeNode right = getNodeAt(node.getRightChild()); node.setHeight(1 + max(left.getHeight(), right.getHeight())); - left.getAABB().union(right.getAABB(), node.getAABB()); + left.getAabb().union(right.getAabb(), node.getAabb()); node = node.getParent() == AABBTreeNode.INVALID_NODE_INDEX ? null : getNodeAt(node.getParent()); } @@ -230,13 +230,13 @@ private void insertNode(int node) { AABBTreeNode nodeToAdd = getNodeAt(node); AABBTreeNode parentNode = getNodeAt(root); - AABBf nodeToAddAABB = nodeToAdd.getAABB(); + AABBf nodeToAddAABB = nodeToAdd.getAabb(); while (!parentNode.isLeaf()) { AABBTreeNode leftChild = getNodeAt(parentNode.getLeftChild()); AABBTreeNode rightChild = getNodeAt(parentNode.getRightChild()); - AABBf aabbA = leftChild.getAABB(); - AABBf aabbB = rightChild.getAABB(); + AABBf aabbA = leftChild.getAabb(); + AABBf aabbB = rightChild.getAabb(); AABBTreeHeuristicFunction.HeuristicResult heuristicResult = insertionHeuristicFunction .getInsertionHeuristic(aabbA, aabbB, nodeToAdd.getData(), nodeToAddAABB); @@ -260,7 +260,7 @@ private void detectCollisionPairsWithNode(AABBTreeNode nodeToTest, CollisionF List> result) { Deque stack = new ArrayDeque<>(); stack.offer(root); - AABBf overlapWith = nodeToTest.getAABB(); + AABBf overlapWith = nodeToTest.getAabb(); while (!stack.isEmpty()) { int nodeIndex = stack.pop(); @@ -269,7 +269,7 @@ private void detectCollisionPairsWithNode(AABBTreeNode nodeToTest, CollisionF } AABBTreeNode node = getNodeAt(nodeIndex); - AABBf nodeAABB = node.getAABB(); + AABBf nodeAABB = node.getAabb(); if (nodeAABB.intersectsAABB(overlapWith)) { if (node.isLeaf() && node.getIndex() != nodeToTest.getIndex()) { T nodeData = node.getData(); @@ -422,7 +422,7 @@ private void traverseTree(Predicate nodeTest, AABBOverlapFilter filte if (nodeIndex == AABBTreeNode.INVALID_NODE_INDEX) continue; AABBTreeNode node = getNodeAt(nodeIndex); - AABBf nodeAABB = node.getAABB(); + AABBf nodeAABB = node.getAabb(); if (nodeTest.test(nodeAABB)) { if (node.isLeaf()) { T nodeData = node.getData(); diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeNode.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeNode.java index 494c99937..6abce071e 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeNode.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeNode.java @@ -1,6 +1,7 @@ package org.allaymc.api.datastruct.aabbtree; import lombok.Getter; +import lombok.Setter; import org.joml.primitives.AABBf; /** @@ -8,30 +9,26 @@ * * @author daoge_cmd */ +@Getter +@Setter public final class AABBTreeNode { public static final int INVALID_NODE_INDEX = -1; + public static final int LEFT_CHILD = 0; public static final int RIGHT_CHILD = 1; + private static final int MAX_NUM_OF_CHILDREN_PER_NODE = 2; - private final int[] children; - private final AABBf aabb; - - @Getter - private int parent; - @Getter - private int index; - @Getter + + private final int[] children = new int[MAX_NUM_OF_CHILDREN_PER_NODE]; + private final AABBf aabb = new AABBf(); + + private int parent = INVALID_NODE_INDEX; + private int index = INVALID_NODE_INDEX; private int height; - @Getter private E data; public AABBTreeNode() { - children = new int[MAX_NUM_OF_CHILDREN_PER_NODE]; assignChildren(INVALID_NODE_INDEX, INVALID_NODE_INDEX); - - aabb = new AABBf(); - parent = INVALID_NODE_INDEX; - index = INVALID_NODE_INDEX; } public boolean isLeaf() { @@ -56,9 +53,7 @@ public void assignChildren(int childA, int childB) { } void computeAABBWithMargin(float margin) { - if (data == null) { - return; - } + if (data == null) return; AABBf dataAABB = data.copyOffsetAABBTo(aabb); aabb.setMin(dataAABB.minX - margin, dataAABB.minY - margin, dataAABB.minZ - margin); aabb.setMax(dataAABB.maxX + margin, dataAABB.maxY + margin, dataAABB.maxZ + margin); @@ -66,14 +61,13 @@ void computeAABBWithMargin(float margin) { public void resetForReuse() { assignChildren(INVALID_NODE_INDEX, INVALID_NODE_INDEX); - aabb.setMin(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); - aabb.setMax(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY); - setParent(INVALID_NODE_INDEX); - setHeight(0); - setData(null); aabb.setMin(Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY, Float.POSITIVE_INFINITY); aabb.setMax(Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY, Float.NEGATIVE_INFINITY); + + this.parent = INVALID_NODE_INDEX; + this.height = 0; + this.data = null; } public int getLeftChild() { @@ -83,24 +77,4 @@ public int getLeftChild() { public int getRightChild() { return children[RIGHT_CHILD]; } - - public AABBf getAABB() { - return aabb; - } - - public void setParent(int parent) { - this.parent = parent; - } - - public void setIndex(int index) { - this.index = index; - } - - public void setHeight(int height) { - this.height = height; - } - - public void setData(E data) { - this.data = data; - } } diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeObject.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeObject.java index 9f1bf2b80..180bd2227 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeObject.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBTreeObject.java @@ -1,5 +1,7 @@ package org.allaymc.api.datastruct.aabbtree; +import lombok.AllArgsConstructor; + import java.util.Objects; /** @@ -7,14 +9,11 @@ * * @author daoge_cmd */ +@AllArgsConstructor final class AABBTreeObject { private final E data; - private AABBTreeObject(E data) { - this.data = data; - } - - static AABBTreeObject create(E data) { + public static AABBTreeObject create(E data) { return new AABBTreeObject<>(data); } @@ -35,7 +34,7 @@ public int hashCode() { return Objects.hash(data.getLongId()); } - E getData() { + public E getData() { return data; } } diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBUtils.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBUtils.java index 994cf2f89..bcee8ae8f 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBUtils.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AABBUtils.java @@ -1,5 +1,6 @@ package org.allaymc.api.datastruct.aabbtree; +import lombok.experimental.UtilityClass; import org.joml.primitives.AABBf; /** @@ -7,12 +8,8 @@ * * @author daoge_cmd */ +@UtilityClass public final class AABBUtils { - - private AABBUtils() { - - } - public static float getWidth(AABBf aabb) { return aabb.maxX - aabb.minX; } @@ -26,9 +23,9 @@ public static float getDepth(AABBf aabb) { } public static float getArea(AABBf aabb) { - final float width = getWidth(aabb); - final float height = getHeight(aabb); - final float depth = getDepth(aabb); + var width = getWidth(aabb); + var height = getHeight(aabb); + var depth = getDepth(aabb); return 2.0f * (width * height + width * depth + height * depth); } } diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AreaAABBHeuristicFunction.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AreaAABBHeuristicFunction.java index 11a075f07..7857ffc4f 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AreaAABBHeuristicFunction.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/AreaAABBHeuristicFunction.java @@ -10,16 +10,12 @@ * @author daoge_cmd */ public class AreaAABBHeuristicFunction implements AABBTreeHeuristicFunction { - private final AABBf temp; - - public AreaAABBHeuristicFunction() { - temp = new AABBf(); - } + private final AABBf temp = new AABBf(); @Override public HeuristicResult getInsertionHeuristic(AABBf left, AABBf right, T object, AABBf objectAABB) { - float diffA = getArea(left.union(objectAABB, temp)) - getArea(left); - float diffB = getArea(right.union(objectAABB, temp)) - getArea(right); + var diffA = getArea(left.union(objectAABB, temp)) - getArea(left); + var diffB = getArea(right.union(objectAABB, temp)) - getArea(right); return diffA < diffB ? HeuristicResult.LEFT : HeuristicResult.RIGHT; } } diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/CollisionPair.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/CollisionPair.java index 816b9ad88..b043c9bb4 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/CollisionPair.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/CollisionPair.java @@ -19,7 +19,7 @@ public boolean equals(Object o) { } CollisionPair that = (CollisionPair) o; return (Objects.equals(objectA.getLongId(), that.objectA.getLongId()) || Objects.equals(objectA.getLongId(), that.objectB.getLongId())) && - (Objects.equals(objectB.getLongId(), that.objectB.getLongId()) || Objects.equals(objectB.getLongId(), that.objectA.getLongId())); + (Objects.equals(objectB.getLongId(), that.objectB.getLongId()) || Objects.equals(objectB.getLongId(), that.objectA.getLongId())); } @Override diff --git a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/HasAABB.java b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/HasAABB.java index 55a87ff0c..0edfc8b30 100644 --- a/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/HasAABB.java +++ b/Allay-API/src/main/java/org/allaymc/api/datastruct/aabbtree/HasAABB.java @@ -8,6 +8,5 @@ * @author daoge_cmd */ public interface HasAABB { - AABBf copyOffsetAABBTo(AABBf dest); } diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/EntityHelper.java b/Allay-API/src/main/java/org/allaymc/api/entity/EntityHelper.java index 0516b5f07..3c3b864b7 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/EntityHelper.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/EntityHelper.java @@ -1,5 +1,6 @@ package org.allaymc.api.entity; +import lombok.experimental.UtilityClass; import lombok.extern.slf4j.Slf4j; import org.allaymc.api.entity.init.SimpleEntityInitInfo; import org.allaymc.api.entity.registry.EntityTypeRegistry; @@ -13,12 +14,13 @@ * @author daoge_cmd */ @Slf4j +@UtilityClass public final class EntityHelper { public static Entity fromNBT(Dimension dimension, NbtMap nbt) { var identifier = new Identifier(nbt.getString("identifier")); var entityType = EntityTypeRegistry.getRegistry().get(identifier); if (entityType == null) { - log.warn("Unknown entity type " + identifier); + log.warn("Unknown entity type {}", identifier); return null; } return entityType.createEntity(SimpleEntityInitInfo.builder().dimension(dimension).nbt(nbt).build()); diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/attribute/AttributeType.java b/Allay-API/src/main/java/org/allaymc/api/entity/attribute/AttributeType.java index 04c6d663b..099d0c85c 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/attribute/AttributeType.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/attribute/AttributeType.java @@ -1,5 +1,8 @@ package org.allaymc.api.entity.attribute; +import lombok.AllArgsConstructor; +import lombok.Getter; + import java.util.HashMap; import java.util.Map; @@ -8,9 +11,11 @@ * * @author JukeboxMC | daoge_cmd */ +@Getter +@AllArgsConstructor public enum AttributeType { - //Base Entity + // Base Entity ABSORPTION("minecraft:absorption", 0, Float.MAX_VALUE, 0), KNOCKBACK_RESISTANCE("minecraft:knockback_resistance", 0, 1, 0.6f), HEALTH("minecraft:health", 0, 20, 20), @@ -20,13 +25,13 @@ public enum AttributeType { LUCK("minecraft:luck", -1024, 1024, 0), FALL_DAMAGE("minecraft:fall_damage", 0, Float.MAX_VALUE, 1), - //Horse + // Horse HORSE_JUMP_STRENGTH("minecraft:horse.jump_strength", 0, 20, 0.7f), - //Zombie + // Zombie ZOMBIE_SPAWN_REINFORCEMENTS("minecraft:zombie.spawn_reinforcements", 0, 1, 0), - //Player + // Player PLAYER_HUNGER("minecraft:player.hunger", 0, 20, 20), PLAYER_SATURATION("minecraft:player.saturation", 0, 20, 20), PLAYER_EXHAUSTION("minecraft:player.exhaustion", 0, 5, 0.41f), @@ -36,7 +41,7 @@ public enum AttributeType { private static final Map KEY_LOOK_UP = new HashMap<>(); static { - for (AttributeType attributeType : values()) { + for (var attributeType : values()) { KEY_LOOK_UP.put(attributeType.key, attributeType); } } @@ -46,13 +51,6 @@ public enum AttributeType { private final float maxValue; private final float defaultValue; - AttributeType(String key, float minValue, float maxValue, float defaultValue) { - this.key = key; - this.minValue = minValue; - this.maxValue = maxValue; - this.defaultValue = defaultValue; - } - public static AttributeType byKey(String key) { return KEY_LOOK_UP.get(key); } diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/component/common/EntityBaseComponent.java b/Allay-API/src/main/java/org/allaymc/api/entity/component/common/EntityBaseComponent.java index 91a21e334..6fd057178 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/component/common/EntityBaseComponent.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/component/common/EntityBaseComponent.java @@ -47,6 +47,10 @@ public interface EntityBaseComponent extends EntityComponent, CommandSender { float STOP_MOVEMENT_FACTOR = 0f; float DEFAULT_PUSH_SPEED_REDUCTION = 1f; + private static boolean isWaterType(BlockType blockType) { + return blockType == BlockTypes.FLOWING_WATER_TYPE || blockType == BlockTypes.WATER_TYPE; + } + EntityType getEntityType(); String getDisplayName(); @@ -68,11 +72,15 @@ default void clearNameTag() { Location3fc getLocation(); /** - * Set the location before the entity is spawned
- * This method is usually used when you want to spawn the entity at a specific location
- * Then you need to set the entity's location before spawn the entity
- * @throws IllegalStateException if the entity is already spawned + * Set the location before the entity is spawned. + *

+ * This method is usually used when you want to spawn the entity at a specific location. + *

+ * Then you need to set the entity's location before spawn the entity. + * * @param location The location you want to set + * + * @throws IllegalStateException if the entity is already spawned */ void setLocationBeforeSpawn(Location3fc location); @@ -263,7 +271,8 @@ default boolean hasGravity() { /** * Given yaw, if the movement multiplier is not 0, the entity will move towards the direction specified by yaw.

- * See: Horizontal Movement Formulas + * + * @see Horizontal Movement Formulas */ default float getMovementFactor() { return STOP_MOVEMENT_FACTOR; @@ -297,10 +306,8 @@ default Chunk getCurrentChunk() { } default BlockFace getHorizontalFace() { - double rotation = getLocation().yaw() % 360; - if (rotation < 0) { - rotation += 360.0; - } + var rotation = getLocation().yaw() % 360; + if (rotation < 0) rotation += 360.0; if (45 <= rotation && rotation < 135) { return BlockFace.WEST; @@ -356,26 +363,19 @@ default boolean isInWater() { int fy = (int) loc.y(); int fz = (int) loc.z(); var blockType = getDimension().getBlockState(fx, fy, fz).getBlockType(); - if (isWaterType(blockType)) { - return true; - } + if (isWaterType(blockType)) return true; + blockType = getDimension().getBlockState(fx, fy, fz, 1).getBlockType(); - if (isWaterType(blockType)) { - return true; - } - return false; + return isWaterType(blockType); } /** - * @param player The player who interacted with the entity, can be null + * @param player The player who interacted with the entity, can be null * @param itemStack The item used to interact with the entity - * @return true if the interaction is successful + * + * @return {@code true} if the interaction is successful */ default boolean onInteract(EntityPlayer player, ItemStack itemStack) { return false; } - - private static boolean isWaterType(BlockType blockType) { - return blockType == BlockTypes.FLOWING_WATER_TYPE || blockType == BlockTypes.WATER_TYPE; - } } diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/component/event/EntityDieEvent.java b/Allay-API/src/main/java/org/allaymc/api/entity/component/event/EntityDieEvent.java index 3189deca2..688e1d1ec 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/component/event/EntityDieEvent.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/component/event/EntityDieEvent.java @@ -1,7 +1,5 @@ package org.allaymc.api.entity.component.event; -import lombok.AllArgsConstructor; -import lombok.Getter; import org.allaymc.api.eventbus.event.Event; /** @@ -9,7 +7,5 @@ * * @author daoge_cmd */ -@Getter -@AllArgsConstructor public class EntityDieEvent extends Event { } diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/component/event/PlayerLoggedInEvent.java b/Allay-API/src/main/java/org/allaymc/api/entity/component/event/PlayerLoggedInEvent.java index 24f505701..c19593e62 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/component/event/PlayerLoggedInEvent.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/component/event/PlayerLoggedInEvent.java @@ -11,6 +11,5 @@ */ @NoArgsConstructor(access = AccessLevel.PRIVATE) public class PlayerLoggedInEvent extends Event { - public static final PlayerLoggedInEvent INSTANCE = new PlayerLoggedInEvent(); } diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/component/player/EntityPlayerBaseComponent.java b/Allay-API/src/main/java/org/allaymc/api/entity/component/player/EntityPlayerBaseComponent.java index 72b546970..8c619013b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/component/player/EntityPlayerBaseComponent.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/component/player/EntityPlayerBaseComponent.java @@ -20,6 +20,8 @@ public interface EntityPlayerBaseComponent extends EntityBaseComponent, ChunkLoader, ScoreboardViewer { + double BLOCK_INTERACT_MAX_DV_DIFF = 2.0; + boolean isSprinting(); void setSprinting(boolean sprinting); @@ -40,10 +42,10 @@ public interface EntityPlayerBaseComponent extends EntityBaseComponent, ChunkLoa void setCrawling(boolean crawling); - void setInteractingBlock(boolean interactingBlock); - boolean isInteractingBlock(); + void setInteractingBlock(boolean interactingBlock); + int getHandSlot(); void setHandSlot(int handSlot); @@ -129,15 +131,13 @@ default void setAction(boolean value) { void showForm(Form form); - double BLOCK_INTERACT_MAX_DV_DIFF = 2.0; - default boolean canInteract(float x, float y, float z) { var maxDistance = getMaxInteractDistance(); var location = getLocation(); if (location.distanceSquared(x, y, z) > maxDistance * maxDistance) return false; var dv = MathUtils.JOMLVecToCBVec(MathUtils.getDirectionVector(location.yaw(), location.pitch())); - org.cloudburstmc.math.vector.Vector3f target = org.cloudburstmc.math.vector.Vector3f.from(x - location.x(), y - location.y(), z - location.z()).normalize(); + var target = org.cloudburstmc.math.vector.Vector3f.from(x - location.x(), y - location.y(), z - location.z()).normalize(); var delta = dv.sub(target); var diff = delta.dot(delta); return diff < BLOCK_INTERACT_MAX_DV_DIFF; diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/damage/DamageContainer.java b/Allay-API/src/main/java/org/allaymc/api/entity/damage/DamageContainer.java index d4b08a2e4..905e9bb1b 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/damage/DamageContainer.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/damage/DamageContainer.java @@ -1,10 +1,10 @@ package org.allaymc.api.entity.damage; -import com.google.common.base.Preconditions; import lombok.Getter; import lombok.Setter; import org.allaymc.api.entity.Entity; +import java.util.Objects; import java.util.function.UnaryOperator; /** @@ -15,6 +15,7 @@ @Getter public class DamageContainer { public static final int DEFAULT_DAMAGE_COOL_DOWN = 10; + protected Entity attacker; protected DamageType damageType; protected float sourceDamage; @@ -29,10 +30,9 @@ public class DamageContainer { public DamageContainer(Entity attacker, DamageType damageType, float sourceDamage) { // attacker is nullable - Preconditions.checkNotNull(damageType); this.attacker = attacker; if (attacker != null) this.critical = attacker.canCriticalAttack(); - this.damageType = damageType; + this.damageType = Objects.requireNonNull(damageType); this.sourceDamage = sourceDamage; this.finalDamage = sourceDamage; } diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/effect/SimpleEffectInstance.java b/Allay-API/src/main/java/org/allaymc/api/entity/effect/SimpleEffectInstance.java index 58f0e0bdb..a4088c679 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/effect/SimpleEffectInstance.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/effect/SimpleEffectInstance.java @@ -9,9 +9,9 @@ * * @author daoge_cmd */ -@AllArgsConstructor @Getter @Setter +@AllArgsConstructor public final class SimpleEffectInstance implements EffectInstance { private final EffectType type; private int amplifier; diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/effect/type/EffectAbsorptionType.java b/Allay-API/src/main/java/org/allaymc/api/entity/effect/type/EffectAbsorptionType.java index a075f3744..539ae315c 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/effect/type/EffectAbsorptionType.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/effect/type/EffectAbsorptionType.java @@ -11,7 +11,6 @@ * @author daoge_cmd */ public class EffectAbsorptionType extends AbstractEffectType { - public static final EffectAbsorptionType ABSORPTION_TYPE = new EffectAbsorptionType(); private EffectAbsorptionType() { diff --git a/Allay-API/src/main/java/org/allaymc/api/entity/metadata/Metadata.java b/Allay-API/src/main/java/org/allaymc/api/entity/metadata/Metadata.java index 63b076d99..07767bc71 100644 --- a/Allay-API/src/main/java/org/allaymc/api/entity/metadata/Metadata.java +++ b/Allay-API/src/main/java/org/allaymc/api/entity/metadata/Metadata.java @@ -18,7 +18,7 @@ public class Metadata { private final EntityDataMap entityDataMap = new EntityDataMap(); public Metadata set(EntityDataType entityData, T value) { - T oldValue = this.entityDataMap.get(entityData); + var oldValue = this.entityDataMap.get(entityData); if (!Objects.equals(oldValue, value)) { this.entityDataMap.put(entityData, value); } @@ -30,7 +30,7 @@ public T get(EntityDataType entityData) { } public Metadata set(EntityFlag entityFlag, boolean value) { - boolean oldValue = this.get(entityFlag); + var oldValue = this.get(entityFlag); if (oldValue != value) { this.entityDataMap.setFlag(entityFlag, value); } diff --git a/Allay-API/src/main/java/org/allaymc/api/eventbus/EventException.java b/Allay-API/src/main/java/org/allaymc/api/eventbus/EventException.java index d400bff2d..d79755fea 100644 --- a/Allay-API/src/main/java/org/allaymc/api/eventbus/EventException.java +++ b/Allay-API/src/main/java/org/allaymc/api/eventbus/EventException.java @@ -6,9 +6,6 @@ * @author daoge_cmd */ public class EventException extends RuntimeException { - public EventException() { - } - public EventException(String message) { super(message); } diff --git a/Allay-API/src/main/java/org/allaymc/api/eventbus/event/Event.java b/Allay-API/src/main/java/org/allaymc/api/eventbus/event/Event.java index 421ff2991..33de5fcd9 100644 --- a/Allay-API/src/main/java/org/allaymc/api/eventbus/event/Event.java +++ b/Allay-API/src/main/java/org/allaymc/api/eventbus/event/Event.java @@ -1,5 +1,6 @@ package org.allaymc.api.eventbus.event; +import lombok.Getter; import org.allaymc.api.eventbus.EventException; /** @@ -8,12 +9,9 @@ * @author daoge_cmd */ public abstract class Event { + @Getter private boolean cancelled = false; - public boolean isCancelled() { - return cancelled; - } - public void setCancelled(boolean value) { if (!(this instanceof CancellableEvent)) { throw new EventException("Event is not Cancellable"); diff --git a/Allay-API/src/main/java/org/allaymc/api/form/FormException.java b/Allay-API/src/main/java/org/allaymc/api/form/FormException.java index a15a6fea0..7d8020ac6 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/FormException.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/FormException.java @@ -6,9 +6,6 @@ * @author daoge_cmd */ public class FormException extends RuntimeException { - public FormException() { - } - public FormException(String message) { super(message); } diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/CustomFormElement.java b/Allay-API/src/main/java/org/allaymc/api/form/element/CustomFormElement.java index 1275adc10..b4af7b01a 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/CustomFormElement.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/CustomFormElement.java @@ -8,6 +8,8 @@ public abstract sealed class CustomFormElement permits Dropdown, Input, Label, Slider, StepSlider, Toggle { - // Only used for server settings form + /** + * Only used for server settings form + */ public abstract void syncDefaultValueToResponse(String response); } diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/Dropdown.java b/Allay-API/src/main/java/org/allaymc/api/form/element/Dropdown.java index 32fee8322..7296f79e0 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/Dropdown.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/Dropdown.java @@ -14,6 +14,7 @@ public final class Dropdown extends CustomFormElement { @SuppressWarnings("unused") private final String type = "dropdown"; + @Getter private final String text; @Getter diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/Input.java b/Allay-API/src/main/java/org/allaymc/api/form/element/Input.java index 6fbc58c73..558eda190 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/Input.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/Input.java @@ -12,6 +12,7 @@ public final class Input extends CustomFormElement { @SuppressWarnings("unused") private final String type = "input"; + @Getter private final String text; @Getter diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/Label.java b/Allay-API/src/main/java/org/allaymc/api/form/element/Label.java index 506fd65ad..e025938d1 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/Label.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/Label.java @@ -11,6 +11,7 @@ public final class Label extends CustomFormElement { @SuppressWarnings("unused") private final String type = "label"; + @Getter private final String text; diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/Slider.java b/Allay-API/src/main/java/org/allaymc/api/form/element/Slider.java index 01efb3312..3dc20bcfa 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/Slider.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/Slider.java @@ -12,6 +12,7 @@ public final class Slider extends CustomFormElement { @SuppressWarnings("unused") private final String type = "slider"; + @Getter private final String text; @Getter diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/StepSlider.java b/Allay-API/src/main/java/org/allaymc/api/form/element/StepSlider.java index 9eef4307b..bddaaa569 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/StepSlider.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/StepSlider.java @@ -14,6 +14,7 @@ public final class StepSlider extends CustomFormElement { @SuppressWarnings("unused") private final String type = "step_slider"; + @Getter private final String text; @Getter diff --git a/Allay-API/src/main/java/org/allaymc/api/form/element/Toggle.java b/Allay-API/src/main/java/org/allaymc/api/form/element/Toggle.java index 4b07bc0ce..5216ed0e2 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/element/Toggle.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/element/Toggle.java @@ -12,6 +12,7 @@ public final class Toggle extends CustomFormElement { @SuppressWarnings("unused") private final String type = "toggle"; + @Getter private final String text; @Getter diff --git a/Allay-API/src/main/java/org/allaymc/api/form/type/CustomForm.java b/Allay-API/src/main/java/org/allaymc/api/form/type/CustomForm.java index 459fa115d..8cfd6a56d 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/type/CustomForm.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/type/CustomForm.java @@ -20,6 +20,7 @@ public final class CustomForm extends Form { @SuppressWarnings("unused") private final String type = "custom_form"; + private final List content = new ArrayList<>(); private String title = ""; private ImageData icon; diff --git a/Allay-API/src/main/java/org/allaymc/api/form/type/Form.java b/Allay-API/src/main/java/org/allaymc/api/form/type/Form.java index 4da3b2809..d8d1487be 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/type/Form.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/type/Form.java @@ -12,6 +12,7 @@ public abstract sealed class Form permits SimpleForm, ModalForm, CustomForm { protected static final Gson GSON = new Gson(); + protected transient Runnable onClose = () -> {}; @Getter protected transient Object response; diff --git a/Allay-API/src/main/java/org/allaymc/api/form/type/ModalForm.java b/Allay-API/src/main/java/org/allaymc/api/form/type/ModalForm.java index 634044cd0..971f8833e 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/type/ModalForm.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/type/ModalForm.java @@ -14,6 +14,7 @@ public final class ModalForm extends Form { @SuppressWarnings("unused") private final String type = "modal"; + private String title = ""; private String content = ""; @SerializedName("button1") @@ -67,11 +68,8 @@ public void handleResponse(String data) { return; } onResponse.accept(data); - if (data.equals("true")) { - onTrue.run(); - } else { - onFalse.run(); - } + if (data.equals("true")) onTrue.run(); + else onFalse.run(); } @Override diff --git a/Allay-API/src/main/java/org/allaymc/api/form/type/SimpleForm.java b/Allay-API/src/main/java/org/allaymc/api/form/type/SimpleForm.java index 4deb238ec..e3c3898a9 100644 --- a/Allay-API/src/main/java/org/allaymc/api/form/type/SimpleForm.java +++ b/Allay-API/src/main/java/org/allaymc/api/form/type/SimpleForm.java @@ -19,6 +19,7 @@ public final class SimpleForm extends Form { @SuppressWarnings("unused") private final String type = "form"; + private final List