From 948bb3af3997be8bdbcdb79e9a572a96da9ef742 Mon Sep 17 00:00:00 2001 From: Dmitry Luk Date: Mon, 13 Jan 2025 19:43:00 +0400 Subject: [PATCH 1/4] fix: custom key for `enableGui` --- CHANGELOG.md | 10 ++++++---- .../java/org/allaymc/api/server/ServerSettings.java | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e183888e1..db9623db4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,8 +32,9 @@ Unless otherwise specified, any version comparison below is the comparison of se - (API) Implemented beacon block, and several related interfaces are added to api module. - (API) `BlockContainer#getBlockPos` and `BlockContainer#setBlockPos` now return/require `Position3ic` instead of `Vector3ic`, this enables us to get the dimension information of a `BlockContainer`. -- (API) Implemented brewing stand, and several related interfaces & objects including `BlockEntityBrewingStand`, `BrewingStandContainer`, - `Registries#POTION_MIX_RECIPES`, `PotionMixRecipe` are added to api module. See commit history for more details. +- (API) Implemented brewing stand, and several related interfaces & objects including `BlockEntityBrewingStand`, + `BrewingStandContainer`, `Registries#POTION_MIX_RECIPES`, `PotionMixRecipe` are added to api module. See commit + history for more details. - (API) Introduced a number of overloads of `Dimension#addSound`. - Implemented trapdoor except redstone feature (Redstone feature requires the implementation of redstone system). - Implemented sponge and wet sponge. @@ -54,12 +55,13 @@ Unless otherwise specified, any version comparison below is the comparison of se - (API) `EntityBaseComponent#getBlockStateStandingOn` now return `BlockStateWithPos` instead of `BlockState`. - (API) Removed `BlockFace#horizontalIndex` which is useless. - (API) Removed `ScoreboardService#ServerEventListener` as it is not supposed to be touched by plugin. -- (API) Methods `BlockEntityFurnaceBaseComponent#getStoredXP` and `BlockEntityFurnaceBaseComponent#setStoredXP` now accept - `int` instead of `float`. +- (API) Methods `BlockEntityFurnaceBaseComponent#getStoredXP` and `BlockEntityFurnaceBaseComponent#setStoredXP` now + accept `int` instead of `float`. - Removed useless class `PackageClassLoaderUtils`, dependency `org.reflections.reflections` is also removed. - Added `-dev` suffix to api version in development build. - Changed `ContainerActionProcessorHolder` to a final class instead of an interface, because this abstraction is meaningless. +- Changed `enableGui` to `enable-gui` in `server-settings.yml` ### Fixed diff --git a/api/src/main/java/org/allaymc/api/server/ServerSettings.java b/api/src/main/java/org/allaymc/api/server/ServerSettings.java index 496698ae3..211fb6451 100644 --- a/api/src/main/java/org/allaymc/api/server/ServerSettings.java +++ b/api/src/main/java/org/allaymc/api/server/ServerSettings.java @@ -78,6 +78,7 @@ public static class GenericSettings extends OkaeriConfig { private boolean isWhitelisted = false; @Comment("Whether to display the GUI") + @CustomKey("enable-gui") private boolean enableGui = true; @CustomKey("max-compute-thread-count") From 1e0c8b1e2c89da1522046f353449c49a04b6735d Mon Sep 17 00:00:00 2001 From: Dmitry Luk Date: Mon, 13 Jan 2025 20:05:24 +0400 Subject: [PATCH 2/4] fix: brewing stand lagging animation & fast brew --- CHANGELOG.md | 1 + ...ckEntityBrewingStandBaseComponentImpl.java | 32 ++++++++----------- 2 files changed, 14 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index db9623db4..e8128258b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -70,6 +70,7 @@ Unless otherwise specified, any version comparison below is the comparison of se - Fixed the bug that interacting with door doesn't have any sound. - Waxing copper-made block using honeycomb won't call `BlockFadeEvent` now. - Fixed the bug that player can still open enchant table even if he is sneaking. +- Fixed the bug that brewing stand fast brew and lagging brew animation. ## [0.1.2](https://github.com/AllayMC/Allay/releases/tag/0.1.2) (API 0.3.0) - 2024-12-31 diff --git a/server/src/main/java/org/allaymc/server/blockentity/component/BlockEntityBrewingStandBaseComponentImpl.java b/server/src/main/java/org/allaymc/server/blockentity/component/BlockEntityBrewingStandBaseComponentImpl.java index f9723ca37..095dc8f7e 100644 --- a/server/src/main/java/org/allaymc/server/blockentity/component/BlockEntityBrewingStandBaseComponentImpl.java +++ b/server/src/main/java/org/allaymc/server/blockentity/component/BlockEntityBrewingStandBaseComponentImpl.java @@ -67,33 +67,38 @@ public void onInitFinish(BlockEntityInitInfo initInfo) { container.addOnSlotChangeListener(BrewingStandContainer.REAGENT_SLOT, item -> { brewTime = item == ItemAirStack.AIR_STACK ? 0 : MAX_BREW_TIME; - sendBrewingStandContainerData(true); }); } @Override public void tick(long currentTick) { - tickBrewingStand(); - sendBrewingStandContainerData(brewTime % 40 == 0); + BrewingStandContainer container = containerHolderComponent.getContainer(); + tickBrewingStand(container); + container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_FUEL_AMOUNT, fuelAmount); + container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_FUEL_TOTAL, fuelTotal); } - protected void tickBrewingStand() { - if (!checkFuel()) { + protected void tickBrewingStand(BrewingStandContainer container) { + if (!checkFuel(container)) { return; } - BrewingStandContainer container = containerHolderComponent.getContainer(); var reagent = container.getReagent(); var a = findRecipe(container.getResult(0), reagent); var b = findRecipe(container.getResult(1), reagent); var c = findRecipe(container.getResult(2), reagent); if (a == null && b == null && c == null) { - brewTime = 0; + brewTime = MAX_BREW_TIME; + container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_BREW_TIME, 0); // We should reset brew animation return; } if (brewTime > 0) { + if (brewTime % 40 == 0) { + container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_BREW_TIME, brewTime); + } + brewTime--; return; } @@ -123,13 +128,11 @@ protected void tickBrewingStand() { getDimension().addSound(position, Sound.RANDOM_POTION_BREWED); } - protected boolean checkFuel() { + protected boolean checkFuel(BrewingStandContainer container) { if (fuelAmount > 0) { return true; } - BrewingStandContainer container = containerHolderComponent.getContainer(); - var fuel = container.getFuel(); if (fuel.getItemType() != ItemTypes.BLAZE_POWDER) { return false; @@ -151,15 +154,6 @@ protected PotionMixRecipe findRecipe(ItemStack ingredient, ItemStack reagent) { return Registries.POTION_MIX_RECIPES.get(PotionMixRecipe.buildIdentifier(ingredient, reagent)); } - protected void sendBrewingStandContainerData(boolean sendBrewTime) { - var container = containerHolderComponent.getContainer(); - if (sendBrewTime) { - container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_BREW_TIME, brewTime); - } - container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_FUEL_AMOUNT, fuelAmount); - container.sendContainerData(ContainerSetDataPacket.BREWING_STAND_FUEL_TOTAL, fuelTotal); - } - @Override public NbtMap saveNBT() { return super.saveNBT() From 62d17fd813918ba948738893d7ef7006c357b47c Mon Sep 17 00:00:00 2001 From: Dmitry Luk Date: Mon, 13 Jan 2025 20:11:28 +0400 Subject: [PATCH 3/4] fix: disable packet limit only in dev build --- CHANGELOG.md | 1 + .../java/org/allaymc/server/network/AllayNetworkInterface.java | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e8128258b..55082a64e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -100,6 +100,7 @@ Unless otherwise specified, any version comparison below is the comparison of se maintainability of the project. - Introduced better names for some of the fields in `PlayerAuthInputPacketProcessor`, this improved the readability of the code. +- Disabled packet limit only in dev build. ### Fixed diff --git a/server/src/main/java/org/allaymc/server/network/AllayNetworkInterface.java b/server/src/main/java/org/allaymc/server/network/AllayNetworkInterface.java index cea917b8d..2244cd8fe 100644 --- a/server/src/main/java/org/allaymc/server/network/AllayNetworkInterface.java +++ b/server/src/main/java/org/allaymc/server/network/AllayNetworkInterface.java @@ -15,6 +15,7 @@ import io.netty.channel.socket.DatagramChannel; import io.netty.channel.socket.nio.NioDatagramChannel; import lombok.extern.slf4j.Slf4j; +import org.allaymc.api.AllayAPI; import org.allaymc.api.entity.type.EntityTypes; import org.allaymc.api.eventbus.event.network.ClientConnectEvent; import org.allaymc.api.i18n.I18n; @@ -75,7 +76,7 @@ public void start() { this.channel = new ServerBootstrap() .channelFactory(RakChannelFactory.server(datagramChannelClass)) .option(RakChannelOption.RAK_ADVERTISEMENT, pong.toByteBuf()) - .option(RakChannelOption.RAK_PACKET_LIMIT, 1000) // This option fixed localhost blocking address + .option(RakChannelOption.RAK_PACKET_LIMIT, AllayAPI.getInstance().isDevBuild() ? Integer.MAX_VALUE : 120) // This option fixed localhost blocking address .group(eventLoopGroup) .childHandler(new BedrockServerInitializer() { @Override From a4a96a187d264203fb08d93ddcfb2aad850a5f5e Mon Sep 17 00:00:00 2001 From: Dmitry Luk Date: Mon, 13 Jan 2025 20:14:39 +0400 Subject: [PATCH 4/4] fix: translation for potion mix loading --- CHANGELOG.md | 3 ++- .../server/registry/loader/PotionMixRecipeRegistryLoader.java | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 55082a64e..daa10274e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -62,6 +62,7 @@ Unless otherwise specified, any version comparison below is the comparison of se - Changed `ContainerActionProcessorHolder` to a final class instead of an interface, because this abstraction is meaningless. - Changed `enableGui` to `enable-gui` in `server-settings.yml` +- Disabled packet limit only in dev build. ### Fixed @@ -71,6 +72,7 @@ Unless otherwise specified, any version comparison below is the comparison of se - Waxing copper-made block using honeycomb won't call `BlockFadeEvent` now. - Fixed the bug that player can still open enchant table even if he is sneaking. - Fixed the bug that brewing stand fast brew and lagging brew animation. +- Fixed translation for potion mix loading. ## [0.1.2](https://github.com/AllayMC/Allay/releases/tag/0.1.2) (API 0.3.0) - 2024-12-31 @@ -100,7 +102,6 @@ Unless otherwise specified, any version comparison below is the comparison of se maintainability of the project. - Introduced better names for some of the fields in `PlayerAuthInputPacketProcessor`, this improved the readability of the code. -- Disabled packet limit only in dev build. ### Fixed diff --git a/server/src/main/java/org/allaymc/server/registry/loader/PotionMixRecipeRegistryLoader.java b/server/src/main/java/org/allaymc/server/registry/loader/PotionMixRecipeRegistryLoader.java index e356dc772..0d21912b8 100644 --- a/server/src/main/java/org/allaymc/server/registry/loader/PotionMixRecipeRegistryLoader.java +++ b/server/src/main/java/org/allaymc/server/registry/loader/PotionMixRecipeRegistryLoader.java @@ -22,7 +22,7 @@ public class PotionMixRecipeRegistryLoader implements RegistryLoader> { @Override public Map load(Void $) { - log.info(TrKeys.A_RECIPE_POTIONMIX_LOADING); + log.info(I18n.get().tr(TrKeys.A_RECIPE_POTIONMIX_LOADING)); var stream = Objects.requireNonNull(Utils.getResource("recipes.json")); var obj = JsonParser.parseReader(new InputStreamReader(stream)).getAsJsonObject();