From a6c487c470688389bae2cf8ccf13a02b6dafa423 Mon Sep 17 00:00:00 2001 From: rlnt Date: Tue, 3 Sep 2024 16:44:57 +0200 Subject: [PATCH] update formatting --- .../merequester/client/RequestSlot.java | 10 ++-- .../merequester/client/RequesterScreen.java | 14 +++--- .../client/RequesterTerminalScreen.java | 33 ++++++++----- .../abstraction/AbstractRequesterScreen.java | 36 +++++++------- .../client/abstraction/RequestDisplay.java | 5 +- .../abstraction/RequesterReference.java | 4 +- .../client/widgets/NumberField.java | 14 +++--- .../client/widgets/RequestWidget.java | 6 ++- .../merequester/client/widgets/StateBox.java | 10 ++-- .../client/widgets/StatusDisplay.java | 8 +-- .../client/widgets/SubmitButton.java | 10 ++-- .../merequester/data/MERequesterRequest.java | 10 ++-- .../mixin/accessors/EditBoxMixin.java | 1 + .../mixin/accessors/SlotMixin.java | 1 + .../mixin/accessors/WidgetContainerMixin.java | 3 +- .../registration/InitMenuTypesMixin.java | 8 +-- .../network/DragAndDropPacket.java | 6 ++- .../merequester/network/PacketHandler.java | 2 + .../network/RequestUpdatePacket.java | 9 ++-- .../network/RequesterSyncPacket.java | 8 +-- .../requester/FacingWithVerticalSpin.java | 3 +- .../merequester/requester/RequesterBlock.java | 16 +++--- .../requester/RequesterBlockEntity.java | 49 +++++++++++-------- .../merequester/requester/RequesterMenu.java | 14 +++--- .../merequester/requester/Requests.java | 20 ++++---- .../merequester/requester/StorageManager.java | 10 ++-- .../abstraction/AbstractRequesterMenu.java | 18 ++++--- .../requester/abstraction/RequestHost.java | 3 +- .../requester/status/ExportState.java | 3 +- .../requester/status/IdleState.java | 3 +- .../requester/status/LinkState.java | 3 +- .../requester/status/MissingState.java | 3 +- .../requester/status/PlanState.java | 3 +- .../requester/status/RequestState.java | 3 +- .../requester/status/RequestStatus.java | 5 +- .../requester/status/StatusState.java | 3 +- .../terminal/RequesterTerminalMenu.java | 20 ++++---- .../terminal/RequesterTerminalPart.java | 12 +++-- .../merequester/blockstates/requester.json | 7 --- 39 files changed, 230 insertions(+), 166 deletions(-) diff --git a/src/main/java/com/almostreliable/merequester/client/RequestSlot.java b/src/main/java/com/almostreliable/merequester/client/RequestSlot.java index da21da8..6bb4e1e 100644 --- a/src/main/java/com/almostreliable/merequester/client/RequestSlot.java +++ b/src/main/java/com/almostreliable/merequester/client/RequestSlot.java @@ -1,14 +1,16 @@ package com.almostreliable.merequester.client; -import appeng.menu.slot.FakeSlot; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.Component; +import net.minecraft.world.item.ItemStack; + import com.almostreliable.merequester.Utils; import com.almostreliable.merequester.client.abstraction.RequestDisplay; import com.almostreliable.merequester.client.abstraction.RequesterReference; import com.almostreliable.merequester.mixin.accessors.SlotMixin; import com.almostreliable.merequester.network.DragAndDropPacket; -import net.minecraft.ChatFormatting; -import net.minecraft.network.chat.Component; -import net.minecraft.world.item.ItemStack; + +import appeng.menu.slot.FakeSlot; import net.neoforged.neoforge.network.PacketDistributor; import javax.annotation.Nullable; diff --git a/src/main/java/com/almostreliable/merequester/client/RequesterScreen.java b/src/main/java/com/almostreliable/merequester/client/RequesterScreen.java index 74a2210..c7a1c7a 100644 --- a/src/main/java/com/almostreliable/merequester/client/RequesterScreen.java +++ b/src/main/java/com/almostreliable/merequester/client/RequesterScreen.java @@ -1,17 +1,19 @@ package com.almostreliable.merequester.client; -import appeng.client.gui.style.ScreenStyle; +import net.minecraft.client.renderer.Rect2i; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.Mth; +import net.minecraft.world.entity.player.Inventory; + import com.almostreliable.merequester.Config; import com.almostreliable.merequester.MERequester; import com.almostreliable.merequester.Utils; import com.almostreliable.merequester.client.abstraction.AbstractRequesterScreen; import com.almostreliable.merequester.client.abstraction.RequesterReference; import com.almostreliable.merequester.requester.RequesterMenu; -import net.minecraft.client.renderer.Rect2i; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.util.Mth; -import net.minecraft.world.entity.player.Inventory; + +import appeng.client.gui.style.ScreenStyle; import javax.annotation.Nullable; import java.util.Collections; diff --git a/src/main/java/com/almostreliable/merequester/client/RequesterTerminalScreen.java b/src/main/java/com/almostreliable/merequester/client/RequesterTerminalScreen.java index a90fc5b..8cb9967 100644 --- a/src/main/java/com/almostreliable/merequester/client/RequesterTerminalScreen.java +++ b/src/main/java/com/almostreliable/merequester/client/RequesterTerminalScreen.java @@ -1,5 +1,18 @@ package com.almostreliable.merequester.client; +import net.minecraft.client.renderer.Rect2i; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; + +import com.almostreliable.merequester.Config; +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.client.abstraction.AbstractRequesterScreen; +import com.almostreliable.merequester.client.abstraction.RequesterReference; +import com.almostreliable.merequester.requester.Requests.Request; +import com.almostreliable.merequester.terminal.RequesterTerminalMenu; + import appeng.api.config.Settings; import appeng.api.config.TerminalStyle; import appeng.api.stacks.AEKey; @@ -8,21 +21,17 @@ import appeng.client.gui.widgets.SettingToggleButton; import appeng.core.AEConfig; import appeng.core.localization.GuiText; -import com.almostreliable.merequester.Config; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.client.abstraction.AbstractRequesterScreen; -import com.almostreliable.merequester.client.abstraction.RequesterReference; -import com.almostreliable.merequester.requester.Requests.Request; -import com.almostreliable.merequester.terminal.RequesterTerminalMenu; import com.google.common.collect.HashMultimap; -import net.minecraft.client.renderer.Rect2i; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Inventory; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.WeakHashMap; public class RequesterTerminalScreen extends AbstractRequesterScreen { diff --git a/src/main/java/com/almostreliable/merequester/client/abstraction/AbstractRequesterScreen.java b/src/main/java/com/almostreliable/merequester/client/abstraction/AbstractRequesterScreen.java index 47c9d88..9f0db3d 100644 --- a/src/main/java/com/almostreliable/merequester/client/abstraction/AbstractRequesterScreen.java +++ b/src/main/java/com/almostreliable/merequester/client/abstraction/AbstractRequesterScreen.java @@ -1,5 +1,24 @@ package com.almostreliable.merequester.client.abstraction; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.gui.components.AbstractWidget; +import net.minecraft.client.renderer.Rect2i; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.ClickType; +import net.minecraft.world.inventory.Slot; +import net.minecraft.world.item.ItemStack; + +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.client.RequestSlot; +import com.almostreliable.merequester.client.widgets.RequestWidget; +import com.almostreliable.merequester.mixin.accessors.WidgetContainerMixin; +import com.almostreliable.merequester.requester.Requests.Request; +import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; + import appeng.api.behaviors.ContainerItemStrategies; import appeng.api.behaviors.EmptyingAction; import appeng.api.stacks.GenericStack; @@ -12,24 +31,7 @@ import appeng.core.localization.Tooltips; import appeng.core.network.serverbound.InventoryActionPacket; import appeng.helpers.InventoryAction; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.client.RequestSlot; -import com.almostreliable.merequester.client.widgets.RequestWidget; -import com.almostreliable.merequester.mixin.accessors.WidgetContainerMixin; -import com.almostreliable.merequester.requester.Requests.Request; -import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; import com.mojang.blaze3d.platform.InputConstants; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.gui.components.AbstractWidget; -import net.minecraft.client.renderer.Rect2i; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.ClickType; -import net.minecraft.world.inventory.Slot; -import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.network.PacketDistributor; import javax.annotation.Nullable; diff --git a/src/main/java/com/almostreliable/merequester/client/abstraction/RequestDisplay.java b/src/main/java/com/almostreliable/merequester/client/abstraction/RequestDisplay.java index 74f730c..0161c29 100644 --- a/src/main/java/com/almostreliable/merequester/client/abstraction/RequestDisplay.java +++ b/src/main/java/com/almostreliable/merequester/client/abstraction/RequestDisplay.java @@ -1,11 +1,12 @@ package com.almostreliable.merequester.client.abstraction; -import com.almostreliable.merequester.client.RequestSlot; -import com.almostreliable.merequester.requester.Requests.Request; import net.minecraft.client.gui.components.AbstractWidget; import net.minecraft.network.chat.Component; import net.minecraft.world.item.ItemStack; +import com.almostreliable.merequester.client.RequestSlot; +import com.almostreliable.merequester.requester.Requests.Request; + import javax.annotation.Nullable; import java.util.List; import java.util.Map; diff --git a/src/main/java/com/almostreliable/merequester/client/abstraction/RequesterReference.java b/src/main/java/com/almostreliable/merequester/client/abstraction/RequesterReference.java index 5b16fd2..3198641 100644 --- a/src/main/java/com/almostreliable/merequester/client/abstraction/RequesterReference.java +++ b/src/main/java/com/almostreliable/merequester/client/abstraction/RequesterReference.java @@ -1,8 +1,10 @@ package com.almostreliable.merequester.client.abstraction; +import net.minecraft.network.chat.Component; + import com.almostreliable.merequester.requester.Requests; import com.almostreliable.merequester.requester.abstraction.RequestHost; -import net.minecraft.network.chat.Component; + import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.OnlyIn; diff --git a/src/main/java/com/almostreliable/merequester/client/widgets/NumberField.java b/src/main/java/com/almostreliable/merequester/client/widgets/NumberField.java index a39d651..cc08611 100644 --- a/src/main/java/com/almostreliable/merequester/client/widgets/NumberField.java +++ b/src/main/java/com/almostreliable/merequester/client/widgets/NumberField.java @@ -1,5 +1,13 @@ package com.almostreliable.merequester.client.widgets; +import net.minecraft.ChatFormatting; +import net.minecraft.client.Minecraft; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.network.chat.Component; + +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.mixin.accessors.EditBoxMixin; + import appeng.api.stacks.AEFluidKey; import appeng.api.stacks.AEKey; import appeng.client.gui.MathExpressionParser; @@ -8,13 +16,7 @@ import appeng.client.gui.widgets.ConfirmableTextField; import appeng.client.gui.widgets.NumberEntryWidget; import appeng.core.localization.GuiText; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.mixin.accessors.EditBoxMixin; import com.mojang.blaze3d.platform.InputConstants; -import net.minecraft.ChatFormatting; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.network.chat.Component; import javax.annotation.Nullable; import java.math.BigDecimal; diff --git a/src/main/java/com/almostreliable/merequester/client/widgets/RequestWidget.java b/src/main/java/com/almostreliable/merequester/client/widgets/RequestWidget.java index e9d6839..52a1d52 100644 --- a/src/main/java/com/almostreliable/merequester/client/widgets/RequestWidget.java +++ b/src/main/java/com/almostreliable/merequester/client/widgets/RequestWidget.java @@ -1,11 +1,13 @@ package com.almostreliable.merequester.client.widgets; -import appeng.client.gui.style.ScreenStyle; +import net.minecraft.client.gui.components.AbstractWidget; + import com.almostreliable.merequester.client.abstraction.RequestDisplay; import com.almostreliable.merequester.client.abstraction.RequesterReference; import com.almostreliable.merequester.network.RequestUpdatePacket; import com.almostreliable.merequester.requester.Requests.Request; -import net.minecraft.client.gui.components.AbstractWidget; + +import appeng.client.gui.style.ScreenStyle; import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.neoforge.network.PacketDistributor; diff --git a/src/main/java/com/almostreliable/merequester/client/widgets/StateBox.java b/src/main/java/com/almostreliable/merequester/client/widgets/StateBox.java index f4787f3..afe0f53 100644 --- a/src/main/java/com/almostreliable/merequester/client/widgets/StateBox.java +++ b/src/main/java/com/almostreliable/merequester/client/widgets/StateBox.java @@ -1,13 +1,15 @@ package com.almostreliable.merequester.client.widgets; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.Rect2i; +import net.minecraft.network.chat.Component; + +import com.almostreliable.merequester.Utils; + import appeng.client.gui.style.Blitter; import appeng.client.gui.style.ScreenStyle; import appeng.client.gui.widgets.AECheckbox; import appeng.client.gui.widgets.ITooltip; -import com.almostreliable.merequester.Utils; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.Rect2i; -import net.minecraft.network.chat.Component; import java.util.List; diff --git a/src/main/java/com/almostreliable/merequester/client/widgets/StatusDisplay.java b/src/main/java/com/almostreliable/merequester/client/widgets/StatusDisplay.java index 7898f23..a846199 100644 --- a/src/main/java/com/almostreliable/merequester/client/widgets/StatusDisplay.java +++ b/src/main/java/com/almostreliable/merequester/client/widgets/StatusDisplay.java @@ -1,8 +1,5 @@ package com.almostreliable.merequester.client.widgets; -import appeng.client.gui.widgets.ITooltip; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.requester.status.RequestStatus; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.AbstractWidget; @@ -11,6 +8,11 @@ import net.minecraft.client.renderer.Rect2i; import net.minecraft.network.chat.Component; +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.requester.status.RequestStatus; + +import appeng.client.gui.widgets.ITooltip; + import java.util.ArrayList; import java.util.List; import java.util.function.BooleanSupplier; diff --git a/src/main/java/com/almostreliable/merequester/client/widgets/SubmitButton.java b/src/main/java/com/almostreliable/merequester/client/widgets/SubmitButton.java index 80588d3..a4c4b14 100644 --- a/src/main/java/com/almostreliable/merequester/client/widgets/SubmitButton.java +++ b/src/main/java/com/almostreliable/merequester/client/widgets/SubmitButton.java @@ -1,13 +1,15 @@ package com.almostreliable.merequester.client.widgets; +import net.minecraft.client.gui.GuiGraphics; +import net.minecraft.client.renderer.Rect2i; +import net.minecraft.network.chat.Component; + +import com.almostreliable.merequester.Utils; + import appeng.client.gui.style.Blitter; import appeng.client.gui.style.ScreenStyle; import appeng.client.gui.widgets.AECheckbox; import appeng.client.gui.widgets.ITooltip; -import com.almostreliable.merequester.Utils; -import net.minecraft.client.gui.GuiGraphics; -import net.minecraft.client.renderer.Rect2i; -import net.minecraft.network.chat.Component; import java.util.List; diff --git a/src/main/java/com/almostreliable/merequester/data/MERequesterRequest.java b/src/main/java/com/almostreliable/merequester/data/MERequesterRequest.java index 9ddbfe0..171eb62 100644 --- a/src/main/java/com/almostreliable/merequester/data/MERequesterRequest.java +++ b/src/main/java/com/almostreliable/merequester/data/MERequesterRequest.java @@ -1,13 +1,15 @@ package com.almostreliable.merequester.data; -import appeng.api.stacks.AEKey; -import com.almostreliable.merequester.requester.status.RequestStatus; -import com.mojang.serialization.Codec; -import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; +import com.almostreliable.merequester.requester.status.RequestStatus; + +import appeng.api.stacks.AEKey; +import com.mojang.serialization.Codec; +import com.mojang.serialization.codecs.RecordCodecBuilder; + import java.util.Optional; public record MERequesterRequest( diff --git a/src/main/java/com/almostreliable/merequester/mixin/accessors/EditBoxMixin.java b/src/main/java/com/almostreliable/merequester/mixin/accessors/EditBoxMixin.java index 14d64e1..97af7e7 100644 --- a/src/main/java/com/almostreliable/merequester/mixin/accessors/EditBoxMixin.java +++ b/src/main/java/com/almostreliable/merequester/mixin/accessors/EditBoxMixin.java @@ -1,6 +1,7 @@ package com.almostreliable.merequester.mixin.accessors; import net.minecraft.client.gui.components.EditBox; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/com/almostreliable/merequester/mixin/accessors/SlotMixin.java b/src/main/java/com/almostreliable/merequester/mixin/accessors/SlotMixin.java index a217a48..9d26bfd 100644 --- a/src/main/java/com/almostreliable/merequester/mixin/accessors/SlotMixin.java +++ b/src/main/java/com/almostreliable/merequester/mixin/accessors/SlotMixin.java @@ -1,6 +1,7 @@ package com.almostreliable.merequester.mixin.accessors; import net.minecraft.world.inventory.Slot; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/com/almostreliable/merequester/mixin/accessors/WidgetContainerMixin.java b/src/main/java/com/almostreliable/merequester/mixin/accessors/WidgetContainerMixin.java index 6486633..ef085b0 100644 --- a/src/main/java/com/almostreliable/merequester/mixin/accessors/WidgetContainerMixin.java +++ b/src/main/java/com/almostreliable/merequester/mixin/accessors/WidgetContainerMixin.java @@ -1,7 +1,8 @@ package com.almostreliable.merequester.mixin.accessors; -import appeng.client.gui.WidgetContainer; import net.minecraft.client.gui.components.AbstractWidget; + +import appeng.client.gui.WidgetContainer; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; diff --git a/src/main/java/com/almostreliable/merequester/mixin/registration/InitMenuTypesMixin.java b/src/main/java/com/almostreliable/merequester/mixin/registration/InitMenuTypesMixin.java index c22edc1..89a8251 100644 --- a/src/main/java/com/almostreliable/merequester/mixin/registration/InitMenuTypesMixin.java +++ b/src/main/java/com/almostreliable/merequester/mixin/registration/InitMenuTypesMixin.java @@ -1,10 +1,12 @@ package com.almostreliable.merequester.mixin.registration; -import appeng.init.InitMenuTypes; -import com.almostreliable.merequester.requester.RequesterMenu; -import com.almostreliable.merequester.terminal.RequesterTerminalMenu; import net.minecraft.core.Registry; import net.minecraft.world.inventory.MenuType; + +import com.almostreliable.merequester.requester.RequesterMenu; +import com.almostreliable.merequester.terminal.RequesterTerminalMenu; + +import appeng.init.InitMenuTypes; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Invoker; import org.spongepowered.asm.mixin.injection.At; diff --git a/src/main/java/com/almostreliable/merequester/network/DragAndDropPacket.java b/src/main/java/com/almostreliable/merequester/network/DragAndDropPacket.java index dc8dade..64ad86b 100644 --- a/src/main/java/com/almostreliable/merequester/network/DragAndDropPacket.java +++ b/src/main/java/com/almostreliable/merequester/network/DragAndDropPacket.java @@ -1,13 +1,15 @@ package com.almostreliable.merequester.network; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; import net.minecraft.network.RegistryFriendlyByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.item.ItemStack; + +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; + import net.neoforged.neoforge.network.handling.IPayloadContext; public record DragAndDropPacket( diff --git a/src/main/java/com/almostreliable/merequester/network/PacketHandler.java b/src/main/java/com/almostreliable/merequester/network/PacketHandler.java index 6780f88..73e4af8 100644 --- a/src/main/java/com/almostreliable/merequester/network/PacketHandler.java +++ b/src/main/java/com/almostreliable/merequester/network/PacketHandler.java @@ -1,10 +1,12 @@ package com.almostreliable.merequester.network; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; + import net.neoforged.neoforge.network.event.RegisterPayloadHandlersEvent; import net.neoforged.neoforge.network.handling.IPayloadHandler; public final class PacketHandler { + private static final String PROTOCOL = "1"; private PacketHandler() {} diff --git a/src/main/java/com/almostreliable/merequester/network/RequestUpdatePacket.java b/src/main/java/com/almostreliable/merequester/network/RequestUpdatePacket.java index a187123..c10cae2 100644 --- a/src/main/java/com/almostreliable/merequester/network/RequestUpdatePacket.java +++ b/src/main/java/com/almostreliable/merequester/network/RequestUpdatePacket.java @@ -1,13 +1,12 @@ package com.almostreliable.merequester.network; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; -import io.netty.buffer.ByteBuf; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; + +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; + import net.neoforged.neoforge.network.handling.IPayloadContext; public record RequestUpdatePacket( diff --git a/src/main/java/com/almostreliable/merequester/network/RequesterSyncPacket.java b/src/main/java/com/almostreliable/merequester/network/RequesterSyncPacket.java index 8589cda..f2de5f8 100644 --- a/src/main/java/com/almostreliable/merequester/network/RequesterSyncPacket.java +++ b/src/main/java/com/almostreliable/merequester/network/RequesterSyncPacket.java @@ -1,13 +1,15 @@ package com.almostreliable.merequester.network; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.client.abstraction.AbstractRequesterScreen; -import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.network.protocol.common.custom.CustomPacketPayload; + +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.client.abstraction.AbstractRequesterScreen; + +import io.netty.buffer.ByteBuf; import net.neoforged.neoforge.network.handling.IPayloadContext; public record RequesterSyncPacket(boolean clearData, long requesterId, CompoundTag data) implements CustomPacketPayload { diff --git a/src/main/java/com/almostreliable/merequester/requester/FacingWithVerticalSpin.java b/src/main/java/com/almostreliable/merequester/requester/FacingWithVerticalSpin.java index 2b0517e..ecaf934 100644 --- a/src/main/java/com/almostreliable/merequester/requester/FacingWithVerticalSpin.java +++ b/src/main/java/com/almostreliable/merequester/requester/FacingWithVerticalSpin.java @@ -1,9 +1,10 @@ package com.almostreliable.merequester.requester; -import appeng.api.orientation.FacingWithSpinStrategy; import net.minecraft.core.Direction; import net.minecraft.world.level.block.state.BlockState; +import appeng.api.orientation.FacingWithSpinStrategy; + class FacingWithVerticalSpin extends FacingWithSpinStrategy { @Override diff --git a/src/main/java/com/almostreliable/merequester/requester/RequesterBlock.java b/src/main/java/com/almostreliable/merequester/requester/RequesterBlock.java index 8bf14c9..665d92c 100644 --- a/src/main/java/com/almostreliable/merequester/requester/RequesterBlock.java +++ b/src/main/java/com/almostreliable/merequester/requester/RequesterBlock.java @@ -1,12 +1,5 @@ package com.almostreliable.merequester.requester; -import appeng.api.orientation.IOrientationStrategy; -import appeng.block.AEBaseEntityBlock; -import appeng.menu.MenuOpener; -import appeng.menu.locator.MenuLocators; -import appeng.util.InteractionUtil; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.Utils; import net.minecraft.ChatFormatting; import net.minecraft.client.gui.screens.Screen; import net.minecraft.core.BlockPos; @@ -23,6 +16,15 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.phys.BlockHitResult; +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.Utils; + +import appeng.api.orientation.IOrientationStrategy; +import appeng.block.AEBaseEntityBlock; +import appeng.menu.MenuOpener; +import appeng.menu.locator.MenuLocators; +import appeng.util.InteractionUtil; + import java.util.List; public class RequesterBlock extends AEBaseEntityBlock { diff --git a/src/main/java/com/almostreliable/merequester/requester/RequesterBlockEntity.java b/src/main/java/com/almostreliable/merequester/requester/RequesterBlockEntity.java index dd7883a..bc1e783 100644 --- a/src/main/java/com/almostreliable/merequester/requester/RequesterBlockEntity.java +++ b/src/main/java/com/almostreliable/merequester/requester/RequesterBlockEntity.java @@ -1,5 +1,27 @@ package com.almostreliable.merequester.requester; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Direction; +import net.minecraft.core.HolderLookup; +import net.minecraft.core.component.DataComponentMap; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.entity.BlockEntityType; +import net.minecraft.world.level.block.state.BlockState; + +import com.almostreliable.merequester.Config; +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.Registration; +import com.almostreliable.merequester.Utils; +import com.almostreliable.merequester.data.MERequesterData; +import com.almostreliable.merequester.requester.abstraction.RequestHost; +import com.almostreliable.merequester.requester.status.LinkState; +import com.almostreliable.merequester.requester.status.RequestStatus; +import com.almostreliable.merequester.requester.status.StatusState; + import appeng.api.config.Actionable; import appeng.api.networking.GridFlags; import appeng.api.networking.IGrid; @@ -17,30 +39,15 @@ import appeng.blockentity.grid.AENetworkedBlockEntity; import appeng.me.helpers.MachineSource; import appeng.util.SettingsFrom; -import com.almostreliable.merequester.Config; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.Registration; -import com.almostreliable.merequester.Utils; -import com.almostreliable.merequester.data.MERequesterData; -import com.almostreliable.merequester.requester.abstraction.RequestHost; -import com.almostreliable.merequester.requester.status.LinkState; -import com.almostreliable.merequester.requester.status.RequestStatus; -import com.almostreliable.merequester.requester.status.StatusState; import com.google.common.collect.ImmutableSet; -import net.minecraft.core.BlockPos; -import net.minecraft.core.Direction; -import net.minecraft.core.HolderLookup; -import net.minecraft.core.component.DataComponentMap; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.level.Level; -import net.minecraft.world.level.block.entity.BlockEntityType; -import net.minecraft.world.level.block.state.BlockState; + import org.jetbrains.annotations.Nullable; -import java.util.*; +import java.util.Arrays; +import java.util.EnumSet; +import java.util.List; +import java.util.Objects; +import java.util.Set; public class RequesterBlockEntity extends AENetworkedBlockEntity implements RequestHost, IGridTickable, ICraftingRequester { diff --git a/src/main/java/com/almostreliable/merequester/requester/RequesterMenu.java b/src/main/java/com/almostreliable/merequester/requester/RequesterMenu.java index 8921cfb..db86e81 100644 --- a/src/main/java/com/almostreliable/merequester/requester/RequesterMenu.java +++ b/src/main/java/com/almostreliable/merequester/requester/RequesterMenu.java @@ -1,15 +1,17 @@ package com.almostreliable.merequester.requester; -import appeng.api.networking.IGrid; -import appeng.menu.implementations.MenuTypeBuilder; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.network.RequesterSyncPacket; -import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; -import com.almostreliable.merequester.requester.abstraction.RequestTracker; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.ItemStack; + +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.network.RequesterSyncPacket; +import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; +import com.almostreliable.merequester.requester.abstraction.RequestTracker; + +import appeng.api.networking.IGrid; +import appeng.menu.implementations.MenuTypeBuilder; import net.neoforged.neoforge.network.PacketDistributor; import javax.annotation.Nullable; diff --git a/src/main/java/com/almostreliable/merequester/requester/Requests.java b/src/main/java/com/almostreliable/merequester/requester/Requests.java index 7c8160e..4e0a68f 100644 --- a/src/main/java/com/almostreliable/merequester/requester/Requests.java +++ b/src/main/java/com/almostreliable/merequester/requester/Requests.java @@ -1,5 +1,16 @@ package com.almostreliable.merequester.requester; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.network.chat.Component; +import net.minecraft.util.Mth; +import net.minecraft.world.item.ItemStack; + +import com.almostreliable.merequester.Config; +import com.almostreliable.merequester.data.MERequesterRequest; +import com.almostreliable.merequester.requester.abstraction.RequestHost; +import com.almostreliable.merequester.requester.status.RequestStatus; + import appeng.api.behaviors.GenericInternalInventory; import appeng.api.config.Actionable; import appeng.api.inventories.InternalInventory; @@ -9,16 +20,7 @@ import appeng.api.stacks.GenericStack; import appeng.api.storage.MEStorage; import appeng.helpers.externalstorage.GenericStackInv; -import com.almostreliable.merequester.Config; -import com.almostreliable.merequester.data.MERequesterRequest; -import com.almostreliable.merequester.requester.abstraction.RequestHost; -import com.almostreliable.merequester.requester.status.RequestStatus; import com.google.common.primitives.Ints; -import net.minecraft.core.HolderLookup; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.network.chat.Component; -import net.minecraft.util.Mth; -import net.minecraft.world.item.ItemStack; import net.neoforged.api.distmarker.Dist; import net.neoforged.api.distmarker.OnlyIn; import net.neoforged.neoforge.common.util.INBTSerializable; diff --git a/src/main/java/com/almostreliable/merequester/requester/StorageManager.java b/src/main/java/com/almostreliable/merequester/requester/StorageManager.java index c0b53c9..62d67e7 100644 --- a/src/main/java/com/almostreliable/merequester/requester/StorageManager.java +++ b/src/main/java/com/almostreliable/merequester/requester/StorageManager.java @@ -1,13 +1,15 @@ package com.almostreliable.merequester.requester; +import net.minecraft.core.HolderLookup; +import net.minecraft.nbt.CompoundTag; +import net.minecraft.world.item.ItemStack; + +import com.almostreliable.merequester.Config; + import appeng.api.config.FuzzyMode; import appeng.api.networking.IStackWatcher; import appeng.api.networking.storage.IStorageWatcherNode; import appeng.api.stacks.AEKey; -import com.almostreliable.merequester.Config; -import net.minecraft.core.HolderLookup; -import net.minecraft.nbt.CompoundTag; -import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.common.util.INBTSerializable; import javax.annotation.Nullable; diff --git a/src/main/java/com/almostreliable/merequester/requester/abstraction/AbstractRequesterMenu.java b/src/main/java/com/almostreliable/merequester/requester/abstraction/AbstractRequesterMenu.java index 17b2f8b..b112b34 100644 --- a/src/main/java/com/almostreliable/merequester/requester/abstraction/AbstractRequesterMenu.java +++ b/src/main/java/com/almostreliable/merequester/requester/abstraction/AbstractRequesterMenu.java @@ -1,18 +1,20 @@ package com.almostreliable.merequester.requester.abstraction; -import appeng.api.behaviors.ContainerItemStrategies; -import appeng.api.networking.IGrid; -import appeng.api.stacks.GenericStack; -import appeng.helpers.InventoryAction; -import appeng.menu.AEBaseMenu; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.network.RequesterSyncPacket; -import com.almostreliable.merequester.requester.RequesterBlockEntity; import net.minecraft.nbt.CompoundTag; import net.minecraft.server.level.ServerPlayer; import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.item.ItemStack; + +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.network.RequesterSyncPacket; +import com.almostreliable.merequester.requester.RequesterBlockEntity; + +import appeng.api.behaviors.ContainerItemStrategies; +import appeng.api.networking.IGrid; +import appeng.api.stacks.GenericStack; +import appeng.helpers.InventoryAction; +import appeng.menu.AEBaseMenu; import net.neoforged.neoforge.network.PacketDistributor; import javax.annotation.Nullable; diff --git a/src/main/java/com/almostreliable/merequester/requester/abstraction/RequestHost.java b/src/main/java/com/almostreliable/merequester/requester/abstraction/RequestHost.java index 6622918..7b54450 100644 --- a/src/main/java/com/almostreliable/merequester/requester/abstraction/RequestHost.java +++ b/src/main/java/com/almostreliable/merequester/requester/abstraction/RequestHost.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.abstraction; -import com.almostreliable.merequester.requester.Requests; import net.minecraft.network.chat.Component; +import com.almostreliable.merequester.requester.Requests; + public interface RequestHost { void saveChanges(); diff --git a/src/main/java/com/almostreliable/merequester/requester/status/ExportState.java b/src/main/java/com/almostreliable/merequester/requester/status/ExportState.java index 7936e5f..425b607 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/ExportState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/ExportState.java @@ -1,9 +1,10 @@ package com.almostreliable.merequester.requester.status; +import com.almostreliable.merequester.requester.RequesterBlockEntity; + import appeng.api.config.Actionable; import appeng.api.networking.ticking.TickRateModulation; import appeng.api.storage.StorageHelper; -import com.almostreliable.merequester.requester.RequesterBlockEntity; public class ExportState implements StatusState { diff --git a/src/main/java/com/almostreliable/merequester/requester/status/IdleState.java b/src/main/java/com/almostreliable/merequester/requester/status/IdleState.java index 57af586..97ff7ce 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/IdleState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/IdleState.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.status; -import appeng.api.networking.ticking.TickRateModulation; import com.almostreliable.merequester.requester.RequesterBlockEntity; +import appeng.api.networking.ticking.TickRateModulation; + public class IdleState implements StatusState { IdleState() {} diff --git a/src/main/java/com/almostreliable/merequester/requester/status/LinkState.java b/src/main/java/com/almostreliable/merequester/requester/status/LinkState.java index bcd6c36..d9a57cd 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/LinkState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/LinkState.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.status; +import com.almostreliable.merequester.requester.RequesterBlockEntity; + import appeng.api.networking.crafting.ICraftingLink; import appeng.api.networking.ticking.TickRateModulation; -import com.almostreliable.merequester.requester.RequesterBlockEntity; public record LinkState(ICraftingLink link) implements StatusState { diff --git a/src/main/java/com/almostreliable/merequester/requester/status/MissingState.java b/src/main/java/com/almostreliable/merequester/requester/status/MissingState.java index f8ec1ca..4cdd16c 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/MissingState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/MissingState.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.status; -import appeng.api.networking.ticking.TickRateModulation; import com.almostreliable.merequester.requester.RequesterBlockEntity; +import appeng.api.networking.ticking.TickRateModulation; + import javax.annotation.Nullable; public class MissingState implements StatusState { diff --git a/src/main/java/com/almostreliable/merequester/requester/status/PlanState.java b/src/main/java/com/almostreliable/merequester/requester/status/PlanState.java index c24f219..b53822e 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/PlanState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/PlanState.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.status; +import com.almostreliable.merequester.requester.RequesterBlockEntity; + import appeng.api.networking.crafting.ICraftingPlan; import appeng.api.networking.ticking.TickRateModulation; -import com.almostreliable.merequester.requester.RequesterBlockEntity; import java.util.Objects; import java.util.concurrent.ExecutionException; diff --git a/src/main/java/com/almostreliable/merequester/requester/status/RequestState.java b/src/main/java/com/almostreliable/merequester/requester/status/RequestState.java index 0416977..b01c8be 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/RequestState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/RequestState.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.status; +import com.almostreliable.merequester.requester.RequesterBlockEntity; + import appeng.api.networking.crafting.CalculationStrategy; import appeng.api.networking.ticking.TickRateModulation; -import com.almostreliable.merequester.requester.RequesterBlockEntity; public class RequestState implements StatusState { diff --git a/src/main/java/com/almostreliable/merequester/requester/status/RequestStatus.java b/src/main/java/com/almostreliable/merequester/requester/status/RequestStatus.java index 08f6c03..89a8318 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/RequestStatus.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/RequestStatus.java @@ -1,12 +1,13 @@ package com.almostreliable.merequester.requester.status; -import com.mojang.serialization.Codec; -import io.netty.buffer.ByteBuf; import net.minecraft.network.codec.ByteBufCodecs; import net.minecraft.network.codec.StreamCodec; import net.minecraft.util.ByIdMap; import net.minecraft.util.StringRepresentable; +import com.mojang.serialization.Codec; +import io.netty.buffer.ByteBuf; + import java.util.Locale; import java.util.function.IntFunction; diff --git a/src/main/java/com/almostreliable/merequester/requester/status/StatusState.java b/src/main/java/com/almostreliable/merequester/requester/status/StatusState.java index 1eb21e4..7177e9e 100644 --- a/src/main/java/com/almostreliable/merequester/requester/status/StatusState.java +++ b/src/main/java/com/almostreliable/merequester/requester/status/StatusState.java @@ -1,8 +1,9 @@ package com.almostreliable.merequester.requester.status; -import appeng.api.networking.ticking.TickRateModulation; import com.almostreliable.merequester.requester.RequesterBlockEntity; +import appeng.api.networking.ticking.TickRateModulation; + public interface StatusState { StatusState IDLE = new IdleState(); diff --git a/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalMenu.java b/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalMenu.java index 6020063..62e2cd8 100644 --- a/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalMenu.java +++ b/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalMenu.java @@ -1,20 +1,22 @@ package com.almostreliable.merequester.terminal; -import appeng.api.networking.IGrid; -import appeng.api.networking.IGridNode; -import appeng.api.networking.security.IActionHost; -import appeng.menu.implementations.MenuTypeBuilder; -import appeng.menu.implementations.PatternAccessTermMenu; +import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.entity.player.Inventory; +import net.minecraft.world.inventory.MenuType; +import net.minecraft.world.item.ItemStack; + import com.almostreliable.merequester.MERequester; import com.almostreliable.merequester.network.RequesterSyncPacket; import com.almostreliable.merequester.requester.RequesterBlockEntity; import com.almostreliable.merequester.requester.abstraction.AbstractRequesterMenu; import com.almostreliable.merequester.requester.abstraction.RequestTracker; + +import appeng.api.networking.IGrid; +import appeng.api.networking.IGridNode; +import appeng.api.networking.security.IActionHost; +import appeng.menu.implementations.MenuTypeBuilder; +import appeng.menu.implementations.PatternAccessTermMenu; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; -import net.minecraft.server.level.ServerPlayer; -import net.minecraft.world.entity.player.Inventory; -import net.minecraft.world.inventory.MenuType; -import net.minecraft.world.item.ItemStack; import net.neoforged.neoforge.network.PacketDistributor; import javax.annotation.Nullable; diff --git a/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalPart.java b/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalPart.java index df39e70..49da429 100644 --- a/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalPart.java +++ b/src/main/java/com/almostreliable/merequester/terminal/RequesterTerminalPart.java @@ -1,5 +1,12 @@ package com.almostreliable.merequester.terminal; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.phys.Vec3; + +import com.almostreliable.merequester.MERequester; +import com.almostreliable.merequester.Utils; + import appeng.api.parts.IPartItem; import appeng.api.parts.IPartModel; import appeng.items.parts.PartModels; @@ -8,11 +15,6 @@ import appeng.parts.PartModel; import appeng.parts.reporting.AbstractDisplayPart; import appeng.parts.reporting.PatternAccessTerminalPart; -import com.almostreliable.merequester.MERequester; -import com.almostreliable.merequester.Utils; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.phys.Vec3; /** * yoinked from {@link PatternAccessTerminalPart} diff --git a/src/main/resources/assets/merequester/blockstates/requester.json b/src/main/resources/assets/merequester/blockstates/requester.json index a13e038..b45e238 100644 --- a/src/main/resources/assets/merequester/blockstates/requester.json +++ b/src/main/resources/assets/merequester/blockstates/requester.json @@ -6,7 +6,6 @@ "active=true,facing=north": { "model": "merequester:block/requester_active" }, - "active=false,facing=east": { "model": "merequester:block/requester", "y": 90 @@ -15,7 +14,6 @@ "model": "merequester:block/requester_active", "y": 90 }, - "active=false,facing=south": { "model": "merequester:block/requester", "y": 180 @@ -24,7 +22,6 @@ "model": "merequester:block/requester_active", "y": 180 }, - "active=false,facing=west": { "model": "merequester:block/requester", "y": 270 @@ -33,7 +30,6 @@ "model": "merequester:block/requester_active", "y": 270 }, - "active=false,facing=up,spin=0": { "ae2:z": 180, "model": "merequester:block/requester", @@ -53,7 +49,6 @@ "model": "merequester:block/requester", "x": 270 }, - "active=true,facing=up,spin=0": { "ae2:z": 180, "model": "merequester:block/requester_active", @@ -73,7 +68,6 @@ "model": "merequester:block/requester_active", "x": 270 }, - "active=false,facing=down,spin=0": { "model": "merequester:block/requester", "x": 90 @@ -93,7 +87,6 @@ "model": "merequester:block/requester", "x": 90 }, - "active=true,facing=down,spin=0": { "model": "merequester:block/requester_active", "x": 90