9
0
mirror of https://github.com/HibiscusMC/HMCCosmetics.git synced 2025-12-19 15:09:19 +00:00

feat: add config option about backpack darkness option

This commit is contained in:
LoJoSho
2025-01-21 11:58:49 -06:00
parent 349311cb58
commit 5d0237e28c
3 changed files with 9 additions and 1 deletions

View File

@@ -72,6 +72,7 @@ public class Settings {
private static final String LOCKED_COSMETIC_COLOR_PATH = "locked-cosmetic-color"; private static final String LOCKED_COSMETIC_COLOR_PATH = "locked-cosmetic-color";
private static final String ENABLED_PATH = "enabled"; private static final String ENABLED_PATH = "enabled";
private static final String SLOT_OPTIONS_PATH = "slot-options"; private static final String SLOT_OPTIONS_PATH = "slot-options";
private static final String BACKPACK_PREVENT_DARKNESS_PATH = "backpack-prevent-darkness";
@Getter @Getter
private static String defaultMenu; private static String defaultMenu;
@@ -121,6 +122,8 @@ public class Settings {
@Getter @Getter
private static boolean balloonHeadForward; private static boolean balloonHeadForward;
@Getter @Getter
private static boolean backpackPreventDarkness;
@Getter
private static List<String> disabledGamemodes; private static List<String> disabledGamemodes;
@Getter @Getter
private static List<String> disabledWorlds; private static List<String> disabledWorlds;
@@ -228,6 +231,7 @@ public class Settings {
emoteMoveCheck = cosmeticSettings.node(COSMETIC_EMOTE_MOVE_CHECK_PATH).getBoolean(false); emoteMoveCheck = cosmeticSettings.node(COSMETIC_EMOTE_MOVE_CHECK_PATH).getBoolean(false);
packetEntityTeleportCooldown = cosmeticSettings.node(COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH).getInt(-1); packetEntityTeleportCooldown = cosmeticSettings.node(COSMETIC_PACKET_ENTITY_TELEPORT_COOLDOWN_PATH).getInt(-1);
balloonHeadForward = cosmeticSettings.node(COSMETIC_BALLOON_HEAD_FORWARD_PATH).getBoolean(false); 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); ConfigurationNode menuSettings = source.node(MENU_SETTINGS_PATH);

View File

@@ -106,7 +106,9 @@ public class HMCCPacketManager extends PacketManager {
final List<WrappedDataValue> wrappedDataValueList = Lists.newArrayList(); final List<WrappedDataValue> wrappedDataValueList = Lists.newArrayList();
// 0x21 = Invisible + Fire (Aka, burns to make it not take the light of the block its in, avoiding turning it black) // 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)); wrappedDataValueList.add(new WrappedDataValue(15, WrappedDataWatcher.Registry.get(Byte.class), (byte) 0x10));
packet.getDataValueCollectionModifier().write(0, wrappedDataValueList); packet.getDataValueCollectionModifier().write(0, wrappedDataValueList);
for (Player p : sendTo) sendPacket(p, packet); for (Player p : sendTo) sendPacket(p, packet);

View File

@@ -53,6 +53,8 @@ cosmetic-settings:
emote-move: false 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. # 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 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 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. # 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 entity-cooldown-teleport-packet: 500