diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java index c7100a16..8fab4477 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/config/Settings.java @@ -72,6 +72,7 @@ public class Settings { private static final String LOCKED_COSMETIC_COLOR_PATH = "locked-cosmetic-color"; private static final String ENABLED_PATH = "enabled"; private static final String SLOT_OPTIONS_PATH = "slot-options"; + private static final String BACKPACK_PREVENT_DARKNESS_PATH = "backpack-prevent-darkness"; @Getter private static String defaultMenu; @@ -121,6 +122,8 @@ public class Settings { @Getter private static boolean balloonHeadForward; @Getter + private static boolean backpackPreventDarkness; + @Getter private static List disabledGamemodes; @Getter private static List disabledWorlds; @@ -228,6 +231,7 @@ public class Settings { emoteMoveCheck = cosmeticSettings.node(COSMETIC_EMOTE_MOVE_CHECK_PATH).getBoolean(false); packetEntityTeleportCooldown = cosmeticSettings.node(COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH).getInt(-1); balloonHeadForward = cosmeticSettings.node(COSMETIC_BALLOON_HEAD_FORWARD_PATH).getBoolean(false); + backpackPreventDarkness = cosmeticSettings.node(BACKPACK_PREVENT_DARKNESS_PATH).getBoolean(true); ConfigurationNode menuSettings = source.node(MENU_SETTINGS_PATH); diff --git a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java index 876e63ae..0d3649e5 100644 --- a/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java +++ b/common/src/main/java/com/hibiscusmc/hmccosmetics/util/packets/HMCCPacketManager.java @@ -106,7 +106,9 @@ public class HMCCPacketManager extends PacketManager { final List wrappedDataValueList = Lists.newArrayList(); // 0x21 = Invisible + Fire (Aka, burns to make it not take the light of the block its in, avoiding turning it black) - wrappedDataValueList.add(new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x21)); + byte mask = 0x20; + if (Settings.isBackpackPreventDarkness()) mask = 0x21; + wrappedDataValueList.add(new WrappedDataValue(0, WrappedDataWatcher.Registry.get(Byte.class), mask)); wrappedDataValueList.add(new WrappedDataValue(15, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x10)); packet.getDataValueCollectionModifier().write(0, wrappedDataValueList); for (Player p : sendTo) sendPacket(p, packet); diff --git a/common/src/main/resources/config.yml b/common/src/main/resources/config.yml index f009c3df..13b347ba 100644 --- a/common/src/main/resources/config.yml +++ b/common/src/main/resources/config.yml @@ -53,6 +53,8 @@ cosmetic-settings: emote-move: false # This make it so it always sends the riding packets for the backpack. This sends more packets but is more reliable for servers which modify player passengers. backpack-force-riding-packet: false + # This prevents the backpack from being dark when the player is below a block at the expense of making the backpack bright + backpack-prevent-darkness: true # This helps reduce the amount of packets sent for packet entities, but reduces accuracy of the entity. This is in milliseconds. -1 to disable. # This is useful for servers with a lot of backpacks, as they are passengers, which means the client will update their position automatically within an area where the entity is located. entity-cooldown-teleport-packet: 500