From f915d4eebdc92f081f47b15ffd21347657372be4 Mon Sep 17 00:00:00 2001 From: Jamalam Date: Sat, 26 Oct 2024 20:40:50 +0100 Subject: [PATCH] 2.5.0 (see commit description) - (feat) compat with LambDynamicLights - When LambDynamicLights is installed, you will be able to put light sources into your Utility Belt and they will illuminate the world around you. - If you have suggestions for other dynamic lights mods to add compat for, please open an issue on GitHub. - Closes #56 - (fix) issue when unequipping belt while you are using it - (fix) general stability improvements - (fix) the belt will now pop out all of its items when it is broken - This means that Netherite tools will not be lost if the belt burns in lava - (feat) add X/Y offset config options for the belt hotbar for more granular control over its position NOTE: THIS COMMIT IS NOT GPG SIGNED BECAUSE MY COMPUTER IS BEING ANNOYINH --- CHANGELOG.md | 5 +++ common/build.gradle | 1 + .../utility_belt/client/Config.java | 2 + .../client/UtilityBeltClient.java | 8 ---- .../client/network/ClientNetworking.java | 28 ++++++++++--- .../client/render/BeltHotbarRenderer.java | 3 ++ .../client/render/BeltRenderer.java | 41 ++++++++++++------- .../jamalam360/utility_belt/UtilityBelt.java | 2 - .../utility_belt/UtilityBeltItem.java | 21 +++++++++- .../utility_belt/mixin/TagLoaderMixin.java | 8 ++++ .../network/ServerNetworking.java | 13 +++++- .../network/UtilityBeltPackets.java | 11 +++++ .../utility_belt/util/DynamicTags.java | 25 +++++++---- .../assets/utility_belt/lang/en_us.json | 4 ++ fabric/build.gradle | 2 + libs.versions.toml | 12 ++++++ neoforge/build.gradle | 5 ++- 17 files changed, 148 insertions(+), 43 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 04a3c2d..b812e4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,3 +2,8 @@ - When LambDynamicLights is installed, you will be able to put light sources into your Utility Belt and they will illuminate the world around you. - If you have suggestions for other dynamic lights mods to add compat for, please open an issue on GitHub. - Closes #56 +- (fix) issue when unequipping belt while you are using it +- (fix) general stability improvements +- (fix) the belt will now pop out all of its items when it is broken + - This means that Netherite tools will not be lost if the belt burns in lava +- (feat) add X/Y offset config options for the belt hotbar for more granular control over its position diff --git a/common/build.gradle b/common/build.gradle index 08d374c..6fd96d1 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -28,6 +28,7 @@ dependencies { modImplementation(libs.accessories.common) { exclude group: "mezz.jei" } + modImplementation libs.owo.lib.fabric // Dependency of Accessories compileOnly libs.mixin.extras.common annotationProcessor libs.mixin.extras.common diff --git a/common/src/client/java/io/github/jamalam360/utility_belt/client/Config.java b/common/src/client/java/io/github/jamalam360/utility_belt/client/Config.java index 3bfa942..9a3cba3 100644 --- a/common/src/client/java/io/github/jamalam360/utility_belt/client/Config.java +++ b/common/src/client/java/io/github/jamalam360/utility_belt/client/Config.java @@ -14,6 +14,8 @@ public class Config implements ConfigExtensions { public boolean useSneakSwapping = true; public HotbarKeyBehaviour hotbarKeyBehaviour = HotbarKeyBehaviour.SWITCH_BELT_SLOT; public Position hotbarPosition = Position.MIDDLE_LEFT; + public int hotbarOffsetX = 0; + public int hotbarOffsetY = 0; @Override public List getLinks() { diff --git a/common/src/client/java/io/github/jamalam360/utility_belt/client/UtilityBeltClient.java b/common/src/client/java/io/github/jamalam360/utility_belt/client/UtilityBeltClient.java index da5c0a3..d90f4f9 100644 --- a/common/src/client/java/io/github/jamalam360/utility_belt/client/UtilityBeltClient.java +++ b/common/src/client/java/io/github/jamalam360/utility_belt/client/UtilityBeltClient.java @@ -51,14 +51,6 @@ public static void init() { UtilityBelt.MENU_TYPE.listen(menu -> MenuRegistry.registerScreenFactory(UtilityBelt.MENU_TYPE.get(), UtilityBeltScreen::new)); UtilityBelt.UTILITY_BELT_ITEM.listen(belt -> AccessoriesRendererRegistry.registerRenderer(belt, BeltRenderer::new)); - UtilityBelt.UTILITY_BELT_UNEQUIP_EVENT.register((stack, reference) -> { - if (reference.entity() instanceof Player player && player.level().isClientSide) { - var manager = StateManager.getStateManager(player); - manager.setInBelt(player, false); - manager.setSelectedBeltSlot(player, 0); - ClientNetworking.sendNewStateToServer(false, 0, false); - } - }); ClientNetworking.init(); StateManager.setClientInstance(new ClientStateManager()); } diff --git a/common/src/client/java/io/github/jamalam360/utility_belt/client/network/ClientNetworking.java b/common/src/client/java/io/github/jamalam360/utility_belt/client/network/ClientNetworking.java index d68534c..a4953e7 100644 --- a/common/src/client/java/io/github/jamalam360/utility_belt/client/network/ClientNetworking.java +++ b/common/src/client/java/io/github/jamalam360/utility_belt/client/network/ClientNetworking.java @@ -1,18 +1,17 @@ package io.github.jamalam360.utility_belt.client.network; import dev.architectury.networking.NetworkManager; +import io.github.jamalam360.utility_belt.UtilityBelt; +import io.github.jamalam360.utility_belt.UtilityBeltInventory; +import io.github.jamalam360.utility_belt.network.UtilityBeltPackets.*; import io.github.jamalam360.utility_belt.state.StateManager; import io.github.jamalam360.utility_belt.UtilityBeltInventory.Mutable; import io.github.jamalam360.utility_belt.network.UtilityBeltPackets; -import io.github.jamalam360.utility_belt.network.UtilityBeltPackets.C2SOpenScreen; -import io.github.jamalam360.utility_belt.network.UtilityBeltPackets.C2SUpdateState; -import io.github.jamalam360.utility_belt.network.UtilityBeltPackets.S2CSetBeltSlot; -import io.github.jamalam360.utility_belt.network.UtilityBeltPackets.S2CSetHotbarSlot; -import io.github.jamalam360.utility_belt.network.UtilityBeltPackets.S2CUpdateBeltInventory; import io.github.jamalam360.utility_belt.client.UtilityBeltClient; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; @Environment(EnvType.CLIENT) public class ClientNetworking { @@ -21,6 +20,7 @@ public static void init() { NetworkManager.registerReceiver(NetworkManager.Side.S2C, UtilityBeltPackets.S2C_SET_BELT_SLOT, S2CSetBeltSlot.STREAM_CODEC, ClientNetworking::handleSetBeltSlot); NetworkManager.registerReceiver(NetworkManager.Side.S2C, UtilityBeltPackets.S2C_SET_HOTBAR_SLOT, S2CSetHotbarSlot.STREAM_CODEC, ClientNetworking::handleSetHotbarSlot); NetworkManager.registerReceiver(NetworkManager.Side.S2C, UtilityBeltPackets.S2C_UPDATE_BELT_INVENTORY, S2CUpdateBeltInventory.STREAM_CODEC, ClientNetworking::handleUpdateBeltInventory); + NetworkManager.registerReceiver(NetworkManager.Side.S2C, UtilityBeltPackets.S2C_BELT_UNEQUIPPED, S2CBeltUnequipped.STREAM_CODEC, ClientNetworking::handleBeltUnequipped); } public static void sendNewStateToServer(boolean inBelt, int slot, boolean swapItems) { @@ -39,7 +39,15 @@ public static void sendOpenScreenToServer() { private static void handleSetBeltSlot(S2CSetBeltSlot payload, NetworkManager.PacketContext ctx) { ctx.queue(() -> { Player player = ctx.getPlayer(); - StateManager.getStateManager(player).setSelectedBeltSlot(player, payload.slot()); + StateManager manager = StateManager.getStateManager(player); + UtilityBeltInventory inventory = manager.getInventory(player); + + if (payload.slot() < 0 || payload.slot() >= inventory.getContainerSize()) { + UtilityBelt.LOGGER.warn("Ignoring request from server to set an invalid belt slot: {}", payload.slot()); + return; + } + + manager.setSelectedBeltSlot(player, payload.slot()); }); } @@ -53,4 +61,12 @@ private static void handleUpdateBeltInventory(S2CUpdateBeltInventory payload, Ne StateManager.getStateManager(player).setInventory(player, new Mutable(payload.inventory())); }); } + + private static void handleBeltUnequipped(S2CBeltUnequipped packet, NetworkManager.PacketContext ctx) { + ctx.queue(() -> { + Player player = ctx.getPlayer(); + StateManager.getStateManager(player).setInBelt(player, false); + StateManager.getStateManager(player).setSelectedBeltSlot(player, 0); + }); + } } diff --git a/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltHotbarRenderer.java b/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltHotbarRenderer.java index f58d90f..f237ff6 100644 --- a/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltHotbarRenderer.java +++ b/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltHotbarRenderer.java @@ -43,6 +43,9 @@ public static void render(GuiGraphics graphics, DeltaTracker deltaTracker) { case MIDDLE_LEFT, MIDDLE_RIGHT -> scaledHeight / 2 - 44; case BOTTOM_LEFT, BOTTOM_RIGHT -> scaledHeight - 84; }; + + x += UtilityBeltClient.CONFIG.get().hotbarOffsetX; + y += UtilityBeltClient.CONFIG.get().hotbarOffsetY; RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); RenderSystem.setShader(GameRenderer::getPositionTexShader); diff --git a/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltRenderer.java b/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltRenderer.java index 24cb6f4..da2326e 100644 --- a/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltRenderer.java +++ b/common/src/client/java/io/github/jamalam360/utility_belt/client/render/BeltRenderer.java @@ -4,15 +4,19 @@ import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.VertexConsumer; import io.github.jamalam360.utility_belt.UtilityBelt; + import java.util.function.Supplier; import io.wispforest.accessories.api.client.AccessoryRenderer; import io.wispforest.accessories.api.slot.SlotReference; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; +import net.minecraft.client.Minecraft; import net.minecraft.client.model.EntityModel; import net.minecraft.client.model.HumanoidModel; import net.minecraft.client.renderer.MultiBufferSource; +import net.minecraft.client.renderer.entity.EntityRenderer; +import net.minecraft.client.renderer.entity.LivingEntityRenderer; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.LivingEntity; @@ -21,18 +25,27 @@ @Environment(EnvType.CLIENT) public class BeltRenderer implements AccessoryRenderer { - private static final ResourceLocation TEXTURE = UtilityBelt.id("textures/entity/belt.png"); - private static final Supplier> MODEL = Suppliers.memoize(() -> - new BeltModel(BeltModel.createLayerDefinition().bakeRoot()) - ); - - @Override - public void render(ItemStack stack, SlotReference reference, PoseStack matrices, EntityModel model, MultiBufferSource multiBufferSource, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { - HumanoidModel beltModel = MODEL.get(); - beltModel.setupAnim(reference.entity(), limbSwing, limbSwingAmount, partialTicks, ageInTicks, headPitch); - beltModel.prepareMobModel(reference.entity(), limbSwing, limbSwingAmount, partialTicks); - AccessoryRenderer.followBodyRotations(reference.entity(), beltModel); - VertexConsumer vertexConsumer = multiBufferSource.getBuffer(beltModel.renderType(TEXTURE)); - beltModel.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); - } + private static final ResourceLocation TEXTURE = UtilityBelt.id("textures/entity/belt.png"); + private static final Supplier> MODEL = Suppliers.memoize(() -> + new BeltModel(BeltModel.createLayerDefinition().bakeRoot()) + ); + + @Override + public void render(ItemStack stack, SlotReference reference, PoseStack matrices, EntityModel model, MultiBufferSource multiBufferSource, int light, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch) { + HumanoidModel beltModel = MODEL.get(); + beltModel.setupAnim(reference.entity(), limbSwing, limbSwingAmount, partialTicks, ageInTicks, headPitch); + beltModel.prepareMobModel(reference.entity(), limbSwing, limbSwingAmount, partialTicks); + followBodyRotations(reference.entity(), beltModel); + VertexConsumer vertexConsumer = multiBufferSource.getBuffer(beltModel.renderType(TEXTURE)); + beltModel.renderToBuffer(matrices, vertexConsumer, light, OverlayTexture.NO_OVERLAY); + } + + @SuppressWarnings("unchecked") + private static void followBodyRotations(LivingEntity entity, HumanoidModel model) { + EntityRenderer render = Minecraft.getInstance().getEntityRenderDispatcher().getRenderer(entity); + + if (render instanceof LivingEntityRenderer renderer && renderer.getModel() instanceof HumanoidModel entityModel) { + ((HumanoidModel) entityModel).copyPropertiesTo(model); + } + } } diff --git a/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBelt.java b/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBelt.java index 70bda97..77b87e7 100644 --- a/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBelt.java +++ b/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBelt.java @@ -40,8 +40,6 @@ public class UtilityBelt { DataComponentType.builder().persistent(UtilityBeltInventory.CODEC).cacheEncoding().build() ); public static final RegistrySupplier> MENU_TYPE = MENUS.register("utility_belt", () -> new MenuType<>(UtilityBeltMenu::new, FeatureFlagSet.of())); - - public static final Event UTILITY_BELT_UNEQUIP_EVENT = EventFactory.createLoop(); public static void init() { JamLib.checkForJarRenaming(UtilityBelt.class); diff --git a/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBeltItem.java b/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBeltItem.java index 6eaeddd..c46c711 100644 --- a/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBeltItem.java +++ b/common/src/main/java/io/github/jamalam360/utility_belt/UtilityBeltItem.java @@ -5,15 +5,18 @@ import java.util.List; import java.util.function.Consumer; +import io.github.jamalam360.utility_belt.network.ServerNetworking; import io.github.jamalam360.utility_belt.state.StateManager; import io.wispforest.accessories.api.AccessoryItem; import io.wispforest.accessories.api.slot.SlotEntryReference; import io.wispforest.accessories.api.slot.SlotReference; import net.minecraft.network.chat.Component; +import net.minecraft.server.level.ServerPlayer; import net.minecraft.sounds.SoundEvents; import net.minecraft.util.Mth; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.SlotAccess; +import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.player.Player; import net.minecraft.world.inventory.ClickAction; import net.minecraft.world.inventory.Slot; @@ -156,9 +159,25 @@ public boolean overrideOtherStackedOnMe(ItemStack belt, ItemStack otherStack, Sl return true; } + @Override + public void onDestroyed(ItemEntity itemEntity) { + super.onDestroyed(itemEntity); + UtilityBeltInventory inv = getInventory(itemEntity.getItem()); + + for (ItemStack stack : inv.items()) { + if (!stack.isEmpty()) { + itemEntity.spawnAtLocation(stack); + } + } + } + @Override public void onUnequip(ItemStack stack, SlotReference reference) { - UtilityBelt.UTILITY_BELT_UNEQUIP_EVENT.invoker().onUnequip(stack, reference); + if (reference.entity() instanceof ServerPlayer player) { + StateManager.getStateManager(player).setInBelt(player, false); + StateManager.getStateManager(player).setSelectedBeltSlot(player, 0); + ServerNetworking.sendBeltUnequippedToClient(player); + } } @Override diff --git a/common/src/main/java/io/github/jamalam360/utility_belt/mixin/TagLoaderMixin.java b/common/src/main/java/io/github/jamalam360/utility_belt/mixin/TagLoaderMixin.java index 3fbde91..f7551ea 100644 --- a/common/src/main/java/io/github/jamalam360/utility_belt/mixin/TagLoaderMixin.java +++ b/common/src/main/java/io/github/jamalam360/utility_belt/mixin/TagLoaderMixin.java @@ -9,7 +9,9 @@ import net.minecraft.tags.TagEntry; import net.minecraft.tags.TagLoader; import net.minecraft.world.item.Item; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -20,11 +22,17 @@ @Mixin(TagLoader.class) public class TagLoaderMixin { + @Shadow @Final private String directory; + @Inject( method = "load", at = @At("TAIL") ) private void utilitybelt$injectDynamicTags(ResourceManager resourceManager, CallbackInfoReturnable>> cir) { + if (!this.directory.equals("tags/item")) { + return; + } + Map> map = cir.getReturnValue(); List list = map.computeIfAbsent(UtilityBelt.ALLOWED_IN_UTILITY_BELT.location(), id -> new ArrayList<>()); diff --git a/common/src/main/java/io/github/jamalam360/utility_belt/network/ServerNetworking.java b/common/src/main/java/io/github/jamalam360/utility_belt/network/ServerNetworking.java index d32e98a..25e2e94 100644 --- a/common/src/main/java/io/github/jamalam360/utility_belt/network/ServerNetworking.java +++ b/common/src/main/java/io/github/jamalam360/utility_belt/network/ServerNetworking.java @@ -29,11 +29,16 @@ private static void registerServerPayloadTypes() { NetworkManager.registerS2CPayloadType(UtilityBeltPackets.S2C_SET_BELT_SLOT, UtilityBeltPackets.S2CSetBeltSlot.STREAM_CODEC); NetworkManager.registerS2CPayloadType(UtilityBeltPackets.S2C_SET_HOTBAR_SLOT, UtilityBeltPackets.S2CSetHotbarSlot.STREAM_CODEC); NetworkManager.registerS2CPayloadType(UtilityBeltPackets.S2C_UPDATE_BELT_INVENTORY, UtilityBeltPackets.S2CUpdateBeltInventory.STREAM_CODEC); + NetworkManager.registerS2CPayloadType(UtilityBeltPackets.S2C_BELT_UNEQUIPPED, UtilityBeltPackets.S2CBeltUnequipped.STREAM_CODEC); } public static void sendInventoryToClient(ServerPlayer player, UtilityBeltInventory inventory) { NetworkManager.sendToPlayer(player, new UtilityBeltPackets.S2CUpdateBeltInventory(inventory)); } + + public static void sendBeltUnequippedToClient(ServerPlayer player) { + NetworkManager.sendToPlayer(player, new UtilityBeltPackets.S2CBeltUnequipped()); + } private static void handleUpdateState(C2SUpdateState payload, NetworkManager.PacketContext ctx) { boolean inBelt = payload.inBelt(); @@ -46,7 +51,13 @@ private static void handleUpdateState(C2SUpdateState payload, NetworkManager.Pac int beltSlot = slot; StateManager stateManager = StateManager.getStateManager(player); stateManager.setInBelt(player, inBelt); - stateManager.setSelectedBeltSlot(player, beltSlot); + + if (beltSlot < 0 || beltSlot >= stateManager.getInventory(player).getContainerSize()) { + UtilityBelt.LOGGER.warn("Ignoring request from client to set an invalid belt slot: {}", beltSlot); + } else { + stateManager.setSelectedBeltSlot(player, beltSlot); + } + player.swing(InteractionHand.MAIN_HAND, true); if (swap) { diff --git a/common/src/main/java/io/github/jamalam360/utility_belt/network/UtilityBeltPackets.java b/common/src/main/java/io/github/jamalam360/utility_belt/network/UtilityBeltPackets.java index 9a44a09..f68a6d2 100644 --- a/common/src/main/java/io/github/jamalam360/utility_belt/network/UtilityBeltPackets.java +++ b/common/src/main/java/io/github/jamalam360/utility_belt/network/UtilityBeltPackets.java @@ -13,6 +13,7 @@ public class UtilityBeltPackets { public static final CustomPacketPayload.Type S2C_SET_BELT_SLOT = new CustomPacketPayload.Type<>(UtilityBelt.id("set_belt_slot")); public static final CustomPacketPayload.Type S2C_SET_HOTBAR_SLOT = new CustomPacketPayload.Type<>(UtilityBelt.id("set_hotbar_slot")); public static final CustomPacketPayload.Type S2C_UPDATE_BELT_INVENTORY = new CustomPacketPayload.Type<>(UtilityBelt.id("update_belt_inventory")); + public static final CustomPacketPayload.Type S2C_BELT_UNEQUIPPED = new CustomPacketPayload.Type<>(UtilityBelt.id("belt_unequipped")); public record C2SUpdateState(boolean inBelt, int slot, boolean swapItems) implements CustomPacketPayload { @@ -80,4 +81,14 @@ public Type type() { return S2C_UPDATE_BELT_INVENTORY; } } + + public record S2CBeltUnequipped() implements CustomPacketPayload { + + public static final StreamCodec STREAM_CODEC = StreamCodec.unit(new S2CBeltUnequipped()); + + @Override + public Type type() { + return S2C_BELT_UNEQUIPPED; + } + } } diff --git a/common/src/main/java/io/github/jamalam360/utility_belt/util/DynamicTags.java b/common/src/main/java/io/github/jamalam360/utility_belt/util/DynamicTags.java index 1a6de78..cc02eef 100644 --- a/common/src/main/java/io/github/jamalam360/utility_belt/util/DynamicTags.java +++ b/common/src/main/java/io/github/jamalam360/utility_belt/util/DynamicTags.java @@ -1,27 +1,34 @@ package io.github.jamalam360.utility_belt.util; +import com.google.common.base.Suppliers; import dev.architectury.platform.Platform; import io.github.jamalam360.utility_belt.UtilityBelt; import net.minecraft.resources.ResourceLocation; import java.util.ArrayList; import java.util.List; +import java.util.function.Supplier; public class DynamicTags { private static final String LAMB_DYNAMIC_LIGHTS = "lambdynlights"; + private static List extraItems = null; public static List getExtraItemsAllowedInUtilityBelt() { - List list = new ArrayList<>(); - - if (Platform.isModLoaded(LAMB_DYNAMIC_LIGHTS)) { - UtilityBelt.LOGGER.info("Registering extra Utility Belt entries for LambDynamicLights compatibility."); - list.add(minecraft("torch")); - list.add(minecraft("redstone_torch")); - list.add(minecraft("soul_torch")); - list.add(minecraft("lantern")); + if (extraItems == null) { + List list = new ArrayList<>(); + + if (Platform.isModLoaded(LAMB_DYNAMIC_LIGHTS)) { + UtilityBelt.LOGGER.info("Registering extra Utility Belt entries for LambDynamicLights compatibility."); + list.add(minecraft("torch")); + list.add(minecraft("redstone_torch")); + list.add(minecraft("soul_torch")); + list.add(minecraft("lantern")); + } + + extraItems = list; } - return list; + return extraItems; } private static ResourceLocation minecraft(String path) { diff --git a/common/src/main/resources/assets/utility_belt/lang/en_us.json b/common/src/main/resources/assets/utility_belt/lang/en_us.json index 1329830..d38db49 100644 --- a/common/src/main/resources/assets/utility_belt/lang/en_us.json +++ b/common/src/main/resources/assets/utility_belt/lang/en_us.json @@ -21,6 +21,10 @@ "config.utility_belt.hotbarPosition.top_right": "Top Right", "config.utility_belt.hotbarPosition.middle_right": "Middle Right", "config.utility_belt.hotbarPosition.bottom_right": "Bottom Right", + "config.utility_belt.hotbarOffsetX": "Hotbar Offset X", + "config.utility_belt.hotbarOffsetX.tooltip": "The horizontal offset in pixels of the hotbar from the base position. Use for fine-tuning the hotbar position.", + "config.utility_belt.hotbarOffsetY": "Hotbar Offset Y", + "config.utility_belt.hotbarOffsetY.tooltip": "The vertical offset in pixels of the hotbar from the base position. Use for fine-tuning the hotbar position.", "config.utility_belt.hotbarKeyBehaviour": "Hotbar Key Behaviour While in Belt", "config.utility_belt.hotbarKeyBehaviour.tooltip": "When set to 'Switch Back', pressing the hotbar key while in the belt will switch back to the hotbar. When set to 'Switch Belt Slot', pressing the hotbar key will switch to the corresponding belt slot.", "config.utility_belt.hotbarKeyBehaviour.switch_back_to_hotbar": "Switch Back", diff --git a/fabric/build.gradle b/fabric/build.gradle index 11ab2da..e81c1c2 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -33,10 +33,12 @@ dependencies { modImplementation libs.architectury.fabric modImplementation libs.jamlib.fabric modImplementation libs.accessories.fabric + modImplementation libs.owo.lib.fabric // Dependency of Accessories modRuntimeOnly libs.modmenu // Compat modImplementation libs.lambdynamiclights + modRuntimeOnly libs.sodium common(project(path: ":common", configuration: "namedElements")) { transitive false } shadowCommon(project(path: ":common", configuration: "transformProductionFabric")) { transitive false } diff --git a/libs.versions.toml b/libs.versions.toml index a853cea..92f3888 100644 --- a/libs.versions.toml +++ b/libs.versions.toml @@ -15,6 +15,10 @@ jamlib = "1.2.1+1.21" # https://modrinth.com/mod/accessories/versions accessories = "1.1.0-beta.11+1.21.1" +# https://modrinth.com/mod/owo/versions +owo-lib-fabric = "0.12.15+1.21" +owo-lib-neoforge = "0.12.15-beta.5+1.21" + # https://github.com/LlamaLad7/MixinExtras/releases mixin-extras = "0.4.1" @@ -24,6 +28,9 @@ modmenu = "11.0.1" # https://modrinth.com/mod/lambdynamiclights/versions lambdynamiclights = "3.1.0+1.21.1" +# https://modrinth.com/mod/sodium/versions +sodium = "mc1.21-0.6.0-beta.2-fabric" + [libraries] architectury-common = { module = "dev.architectury:architectury", version.ref = "architectury" } architectury-fabric = { module = "dev.architectury:architectury-fabric", version.ref = "architectury" } @@ -42,8 +49,13 @@ accessories-common = { module = "io.wispforest:accessories-common", version.ref accessories-fabric = { module = "io.wispforest:accessories-fabric", version.ref = "accessories" } accessories-neoforge = { module = "io.wispforest:accessories-neoforge", version.ref = "accessories" } +owo-lib-fabric = { module = "io.wispforest:owo-lib", version.ref = "owo-lib-fabric" } +owo-lib-neoforge = { module = "io.wispforest:owo-lib-neoforge", version.ref = "owo-lib-neoforge" } + mixin-extras-common = { module = "io.github.llamalad7:mixinextras-common", version.ref = "mixin-extras" } modmenu = { module = "maven.modrinth:modmenu", version.ref = "modmenu" } lambdynamiclights = { module = "dev.lambdaurora.lambdynamiclights:lambdynamiclights-runtime", version.ref = "lambdynamiclights" } + +sodium = { module = "maven.modrinth:sodium", version.ref = "sodium" } diff --git a/neoforge/build.gradle b/neoforge/build.gradle index f4898cb..aa91738 100644 --- a/neoforge/build.gradle +++ b/neoforge/build.gradle @@ -30,8 +30,9 @@ repositories { dependencies { neoForge libs.neoforge modImplementation libs.architectury.neoforge - modImplementation libs.jamlib.neoforge - modRuntimeOnly libs.accessories.neoforge + modImplementation libs.jamlib.neoforge + modImplementation libs.accessories.neoforge + modImplementation libs.owo.lib.neoforge // Dependency of Accessories forgeRuntimeLibrary "blue.endless:jankson:1.2.3" // Dependency of JamLib forgeRuntimeLibrary "io.wispforest:endec:0.1.5" // Dependency of Accessories