From d3cf12c429c22538f6c663c612cda0a7f7046000 Mon Sep 17 00:00:00 2001 From: TexTrue <65154269+TexBlock@users.noreply.github.com> Date: Fri, 8 Nov 2024 21:57:10 +0800 Subject: [PATCH] sync from 1.21.3-0.22.0-sakura.4 --- CHANGELOG.md | 2 +- gradle/libs.versions.toml | 10 +- .../fi/dy/masa/tweakeroo/InitHandler.java | 3 - .../tweakeroo/config/ConfigBooleanClient.java | 11 +- .../fi/dy/masa/tweakeroo/config/Configs.java | 346 +++++++++--------- .../masa/tweakeroo/config/FeatureToggle.java | 47 ++- .../fi/dy/masa/tweakeroo/config/Hotkeys.java | 91 ++--- .../dy/masa/tweakeroo/data/DataManager.java | 9 +- .../masa/tweakeroo/data/ServerDataSyncer.java | 14 +- .../dy/masa/tweakeroo/event/InputHandler.java | 23 +- .../masa/tweakeroo/event/RenderHandler.java | 16 +- .../tweakeroo/event/WorldLoadListener.java | 2 + .../tweakeroo/mixin/IMixinPiglinEntity.java | 2 +- .../mixin/MixinAbstractSignEditScreen.java | 8 +- .../mixin/MixinBackgroundRenderer.java | 62 +--- .../mixin/MixinChunkBuilder_BuiltChunk.java | 2 +- .../mixin/MixinClientCommandSource.java | 3 + .../MixinClientCommonNetworkHandler.java | 5 +- .../mixin/MixinClientPlayNetworkHandler.java | 13 +- .../mixin/MixinClientPlayerEntity.java | 10 +- .../MixinClientPlayerInteractionManager.java | 1 - .../tweakeroo/mixin/MixinClientWorld.java | 17 +- .../mixin/MixinCommandBlockScreen.java | 40 +- .../mixin/MixinCreativeInventoryScreen.java | 4 +- .../mixin/MixinDataQueryHandler.java | 10 +- .../dy/masa/tweakeroo/mixin/MixinEntity.java | 12 +- .../tweakeroo/mixin/MixinGameRenderer.java | 13 +- .../mixin/MixinGameRenderer_ViewBob.java | 3 +- .../mixin/MixinHopperBlockEntity.java | 2 +- .../masa/tweakeroo/mixin/MixinItemStack.java | 3 +- .../tweakeroo/mixin/MixinKeyboardInput.java | 12 +- .../tweakeroo/mixin/MixinLivingEntity.java | 28 +- .../tweakeroo/mixin/MixinMinecraftClient.java | 8 +- .../tweakeroo/mixin/MixinObserverBlock.java | 14 +- .../tweakeroo/mixin/MixinPresetsScreen.java | 91 +---- .../tweakeroo/mixin/MixinSignBlockEntity.java | 4 +- .../mixin/MixinStructureBlockBlockEntity.java | 2 +- .../tweakeroo/mixin/MixinWorldRenderer.java | 40 +- .../masa/tweakeroo/renderer/RenderUtils.java | 218 ++--------- .../dy/masa/tweakeroo/tweaks/MiscTweaks.java | 17 +- .../tweakeroo/tweaks/PlacementHandler.java | 10 +- .../tweakeroo/tweaks/PlacementTweaks.java | 223 ++++------- .../dy/masa/tweakeroo/util/CameraUtils.java | 10 +- .../tweakeroo/util/EntityRestriction.java | 8 +- .../dy/masa/tweakeroo/util/IGuiEditSign.java | 4 +- .../masa/tweakeroo/util/ISignTextAccess.java | 2 +- .../masa/tweakeroo/util/InventoryUtils.java | 46 ++- .../masa/tweakeroo/util/ItemRestriction.java | 10 +- .../fi/dy/masa/tweakeroo/util/MiscUtils.java | 24 +- .../tweakeroo/util/PotionRestriction.java | 9 +- .../dy/masa/tweakeroo/util/RayTraceUtils.java | 24 +- src/main/resources/tweakerge.mixins.json | 5 +- 52 files changed, 643 insertions(+), 950 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 94071f1..a53a036 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,2 +1,2 @@ ## Change -- sync from 1.21-0.21.51 \ No newline at end of file +- sync from 1.21.3-0.22.0-sakura.4 \ No newline at end of file diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 5338cc6..87f79bc 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,12 +1,12 @@ [versions] # Base properties -minecraft_version="1.21.1" -yarn_mappings="1.21.1+build.3" +minecraft_version="1.21.3" +yarn_mappings="1.21.3+build.2" mappings_patch="1.21+build.4" -neoforge="21.1.74" +neoforge="21.3.2-beta" # Mod properties -version="0.1.8" +version="0.1.9" maven-group="org.thinkingstudio.tweakerge" archives-name="Tweakerge" @@ -15,7 +15,7 @@ id-modrinth="yke6wdGF" id-curseforge="915857" # Mod dependencies -mafglib="0.1.24-mc1.21.1" +mafglib="0.1.24-mc1.21.3" badpackets="neo-0.8.1" # Libraries diff --git a/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java b/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java index 3ecbad9..2d27242 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/InitHandler.java @@ -32,13 +32,10 @@ public void registerModHandlers() RenderEventHandler.getInstance().registerTooltipLastRenderer(renderer); RenderEventHandler.getInstance().registerWorldLastRenderer(renderer); - TickHandler.getInstance().registerClientTickHandler(new ClientTickHandler()); - IWorldLoadListener worldListener = new WorldLoadListener(); WorldLoadHandler.getInstance().registerWorldLoadPreHandler(worldListener); WorldLoadHandler.getInstance().registerWorldLoadPostHandler(worldListener); - ServerHandler.getInstance().registerServerHandler(DataManager.getInstance()); TickHandler.getInstance().registerClientTickHandler(new ClientTickHandler()); diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/ConfigBooleanClient.java b/src/main/java/fi/dy/masa/tweakeroo/config/ConfigBooleanClient.java index 465edaa..5d53944 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/ConfigBooleanClient.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/ConfigBooleanClient.java @@ -8,14 +8,19 @@ public class ConfigBooleanClient extends ConfigBooleanHotkeyed { + public ConfigBooleanClient(String name, boolean defaultValue, String defaultHotkey) + { + this(name, defaultValue, defaultHotkey, name+" Comment!", StringUtils.splitCamelCase(name), name); + } + public ConfigBooleanClient(String name, boolean defaultValue, String defaultHotkey, String comment) { - this(name, defaultValue, defaultHotkey, comment, name); + this(name, defaultValue, defaultHotkey, comment, StringUtils.splitCamelCase(name), name); } - public ConfigBooleanClient(String name, boolean defaultValue, String defaultHotkey, String comment, String prettyName) + public ConfigBooleanClient(String name, boolean defaultValue, String defaultHotkey, String comment, String prettyName, String translatedName) { - super(name, defaultValue, defaultHotkey, comment, prettyName); + super(name, defaultValue, defaultHotkey, comment, prettyName, translatedName); } @Override diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java index ff8ae4d..fdee3f4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/Configs.java @@ -35,96 +35,102 @@ public class Configs implements IConfigHandler { private static final String CONFIG_FILE_NAME = Reference.MOD_ID + ".json"; + private static final String GENERIC_KEY = Reference.ID+".config.generic"; + private static final String FIXES_KEY = Reference.ID+".config.fixes"; + private static final String LISTS_KEY = Reference.ID+".config.lists"; + private static final String DISABLE_KEY = Reference.ID+".config.disable"; + private static final String INTERNAL_KEY = Reference.ID+".config.internal"; + public static class Generic { - public static final ConfigOptionList ACCURATE_PLACEMENT_PROTOCOL_MODE = new ConfigOptionList ("accuratePlacementProtocolMode", EasyPlacementProtocol.AUTO, "tweakeroo.config.generic.comment.accuratePlacementProtocolMode").translatedName("tweakeroo.config.generic.name.accuratePlacementProtocolMode"); - public static final ConfigBoolean ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("accuratePlacementProtocol", true, "tweakeroo.config.generic.comment.accuratePlacementProtocol").translatedName("tweakeroo.config.generic.name.accuratePlacementProtocol"); - public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "tweakeroo.config.generic.comment.afterClickerClickCount").translatedName("tweakeroo.config.generic.name.afterClickerClickCount"); - public static final ConfigDouble ANGEL_BLOCK_PLACEMENT_DISTANCE = new ConfigDouble ("angelBlockPlacementDistance", 3, 1, 5, "tweakeroo.config.generic.comment.angelBlockPlacementDistance").translatedName("tweakeroo.config.generic.name.angelBlockPlacementDistance"); - public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 1, 64, "tweakeroo.config.generic.comment.blockReachDistance").translatedName("tweakeroo.config.generic.name.blockReachDistance"); - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE, "tweakeroo.config.generic.comment.blockTypeBreakRestrictionWarn").translatedName("tweakeroo.config.generic.name.blockTypeBreakRestrictionWarn"); - public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000, "tweakeroo.config.generic.comment.breakingGridSize").translatedName("tweakeroo.config.generic.name.breakingGridSize"); - public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "tweakeroo.config.generic.comment.breakingRestrictionMode").translatedName("tweakeroo.config.generic.name.breakingRestrictionMode"); - public static final ConfigBoolean BUNDLE_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("bundleDisplayBgColor", true, "tweakeroo.config.generic.comment.bundleDisplayBgColor").translatedName("tweakeroo.config.generic.name.bundleDisplayBgColor"); - public static final ConfigBoolean BUNDLE_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("bundleDisplayRequireShift", true, "tweakeroo.config.generic.comment.bundleDisplayRequireShift").translatedName("tweakeroo.config.generic.name.bundleDisplayRequireShift"); - public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000", "tweakeroo.config.generic.comment.chatBackgroundColor").translatedName("tweakeroo.config.generic.name.chatBackgroundColor"); - public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]", "tweakeroo.config.generic.comment.chatTimeFormat").translatedName("tweakeroo.config.generic.name.chatTimeFormat"); - public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true, "tweakeroo.config.generic.comment.clientPlacementRotation").translatedName("tweakeroo.config.generic.name.clientPlacementRotation"); - public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "tweakeroo.config.generic.comment.customInventoryGuiScale").translatedName("tweakeroo.config.generic.name.customInventoryGuiScale"); - public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "tweakeroo.config.generic.comment.debugLogging").translatedName("tweakeroo.config.generic.name.debugLogging"); - public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY, "tweakeroo.config.generic.comment.elytraCameraIndicator").translatedName("tweakeroo.config.generic.name.elytraCameraIndicator"); - public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 1, 64, "tweakeroo.config.generic.comment.entityReachDistance").translatedName("tweakeroo.config.generic.name.entityReachDistance"); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE, "tweakeroo.config.generic.comment.entityTypeAttackRestrictionWarn").translatedName("tweakeroo.config.generic.name.entityTypeAttackRestrictionWarn"); - public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16, "tweakeroo.config.generic.comment.fastBlockPlacementCount").translatedName("tweakeroo.config.generic.name.fastBlockPlacementCount"); - public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false, "tweakeroo.config.generic.comment.fastLeftClickAllowTools").translatedName("tweakeroo.config.generic.name.fastLeftClickAllowTools"); - public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger ("fastLeftClickCount", 10, 1, 64, "tweakeroo.config.generic.comment.fastLeftClickCount").translatedName("tweakeroo.config.generic.name.fastLeftClickCount"); - public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean ("fastPlacementRememberOrientation", true, "tweakeroo.config.generic.comment.fastPlacementRememberOrientation").translatedName("tweakeroo.config.generic.name.fastPlacementRememberOrientation"); - public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger ("fastRightClickCount", 10, 1, 64, "tweakeroo.config.generic.comment.fastRightClickCount").translatedName("tweakeroo.config.generic.name.fastRightClickCount"); - public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger ("fillCloneLimit", 10000000, 1, 1000000000, "tweakeroo.config.generic.comment.fillCloneLimit").translatedName("tweakeroo.config.generic.name.fillCloneLimit"); - public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor ("flexibleBlockPlacementOverlayColor", "#C03030F0", "tweakeroo.config.generic.comment.flexibleBlockPlacementOverlayColor").translatedName("tweakeroo.config.generic.name.flexibleBlockPlacementOverlayColor"); - public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble ("flyDecelerationFactor", 0.4, 0.0, 1.0, "tweakeroo.config.generic.comment.flyDecelerationFactor").translatedName("tweakeroo.config.generic.name.flyDecelerationFactor"); - public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble ("flySpeedPreset1", 0.01, 0, 4, "tweakeroo.config.generic.comment.flySpeedPreset1").translatedName("tweakeroo.config.generic.name.flySpeedPreset1"); - public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble ("flySpeedPreset2", 0.064, 0, 4, "tweakeroo.config.generic.comment.flySpeedPreset2").translatedName("tweakeroo.config.generic.name.flySpeedPreset2"); - public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble ("flySpeedPreset3", 0.128, 0, 4, "tweakeroo.config.generic.comment.flySpeedPreset3").translatedName("tweakeroo.config.generic.name.flySpeedPreset3"); - public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble ("flySpeedPreset4", 0.32, 0, 4, "tweakeroo.config.generic.comment.flySpeedPreset4").translatedName("tweakeroo.config.generic.name.flySpeedPreset4"); - public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean ("freeCameraPlayerInputs", false, "tweakeroo.config.generic.comment.freeCameraPlayerInputs").translatedName("tweakeroo.config.generic.name.freeCameraPlayerInputs"); - public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean ("freeCameraPlayerMovement", false, "tweakeroo.config.generic.comment.freeCameraPlayerMovement").translatedName("tweakeroo.config.generic.name.freeCameraPlayerMovement"); - public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble ("gammaOverrideValue", 16, 0, 32, "tweakeroo.config.generic.comment.gammaOverrideValue").translatedName("tweakeroo.config.generic.name.gammaOverrideValue"); - public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean ("handRestockPre", true, "tweakeroo.config.generic.comment.handRestockPre").translatedName("tweakeroo.config.generic.name.handRestockPre"); - public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger ("handRestockPreThreshold", 6, 1, 64, "tweakeroo.config.generic.comment.handRestockPreThreshold").translatedName("tweakeroo.config.generic.name.handRestockPreThreshold"); - public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean ("hangableEntityBypassInverse", false, "tweakeroo.config.generic.comment.hangableEntityBypassInverse").translatedName("tweakeroo.config.generic.name.hangableEntityBypassInverse"); - public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger ("hotbarSlotCycleMax", 2, 1, 9, "tweakeroo.config.generic.comment.hotbarSlotCycleMax").translatedName("tweakeroo.config.generic.name.hotbarSlotCycleMax"); - public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger ("hotbarSlotRandomizerMax", 5, 1, 9, "tweakeroo.config.generic.comment.hotbarSlotRandomizerMax").translatedName("tweakeroo.config.generic.name.hotbarSlotRandomizerMax"); - public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList ("hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT, "tweakeroo.config.generic.comment.hotbarSwapOverlayAlignment").translatedName("tweakeroo.config.generic.name.hotbarSwapOverlayAlignment"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger ("hotbarSwapOverlayOffsetX", 4, "tweakeroo.config.generic.comment.hotbarSwapOverlayOffsetX").translatedName("tweakeroo.config.generic.name.hotbarSwapOverlayOffsetX"); - public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger ("hotbarSwapOverlayOffsetY", 4, "tweakeroo.config.generic.comment.hotbarSwapOverlayOffsetY").translatedName("tweakeroo.config.generic.name.hotbarSwapOverlayOffsetY"); - public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger ("itemSwapDurabilityThreshold", 20, 5, 10000, "tweakeroo.config.generic.comment.itemSwapDurabilityThreshold").translatedName("tweakeroo.config.generic.name.itemSwapDurabilityThreshold"); - public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean ("itemUsePacketCheckBypass", true, "tweakeroo.config.generic.comment.itemUsePacketCheckBypass").translatedName("tweakeroo.config.generic.name.itemUsePacketCheckBypass"); - public static final ConfigBoolean MAP_PREVIEW_REQUIRE_SHIFT = new ConfigBoolean ("mapPreviewRequireShift", true, "tweakeroo.config.generic.comment.mapPreviewRequireShift").translatedName("tweakeroo.config.generic.name.mapPreviewRequireShift"); - public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger ("mapPreviewSize", 160, 16, 512, "tweakeroo.config.generic.comment.mapPreviewSize").translatedName("tweakeroo.config.generic.name.mapPreviewSize"); - public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger ("periodicAttackInterval", 20, 0, Integer.MAX_VALUE, "tweakeroo.config.generic.comment.periodicAttackInterval").translatedName("tweakeroo.config.generic.name.periodicAttackInterval"); - public static final ConfigBoolean PERIODIC_ATTACK_RESET_ON_ACTIVATE = new ConfigBoolean ("periodicAttackResetIntervalOnActivate", true, "tweakeroo.config.generic.comment.periodicAttackResetIntervalOnActivate").translatedName("tweakeroo.config.generic.name.periodicAttackResetIntervalOnActivate"); - public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger ("periodicUseInterval", 20, 0, Integer.MAX_VALUE, "tweakeroo.config.generic.comment.periodicUseInterval").translatedName("tweakeroo.config.generic.name.periodicUseInterval"); - public static final ConfigBoolean PERIODIC_USE_RESET_ON_ACTIVATE = new ConfigBoolean ("periodicUseResetIntervalOnActivate", true, "tweakeroo.config.generic.comment.periodicUseResetIntervalOnActivate").translatedName("tweakeroo.config.generic.name.periodicUseResetIntervalOnActivate"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger ("periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE, "tweakeroo.config.generic.comment.periodicHoldAttackDuration").translatedName("tweakeroo.config.generic.name.periodicHoldAttackDuration"); - public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger ("periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE, "tweakeroo.config.generic.comment.periodicHoldAttackInterval").translatedName("tweakeroo.config.generic.name.periodicHoldAttackInterval"); - public static final ConfigBoolean PERIODIC_HOLD_ATTACK_RESET_ON_ACTIVATE= new ConfigBoolean ("periodicHoldAttackResetIntervalOnActivate", true, "tweakeroo.config.generic.comment.periodicHoldAttackResetIntervalOnActivate").translatedName("tweakeroo.config.generic.name.periodicHoldAttackResetIntervalOnActivate"); - public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger ("periodicHoldUseDuration", 20, 0, Integer.MAX_VALUE, "tweakeroo.config.generic.comment.periodicHoldUseDuration").translatedName("tweakeroo.config.generic.name.periodicHoldUseDuration"); - public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger ("periodicHoldUseInterval", 20, 0, Integer.MAX_VALUE, "tweakeroo.config.generic.comment.periodicHoldUseInterval").translatedName("tweakeroo.config.generic.name.periodicHoldUseInterval"); - public static final ConfigBoolean PERIODIC_HOLD_USE_RESET_ON_ACTIVATE = new ConfigBoolean ("periodicHoldUseResetIntervalOnActivate", true, "tweakeroo.config.generic.comment.periodicHoldUseResetIntervalOnActivate").translatedName("tweakeroo.config.generic.name.periodicHoldUseResetIntervalOnActivate"); - public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean ("permanentSneakAllowInGUIs", false, "tweakeroo.config.generic.comment.permanentSneakAllowInGUIs").translatedName("tweakeroo.config.generic.name.permanentSneakAllowInGUIs"); - public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger ("placementGridSize", 3, 1, 1000, "tweakeroo.config.generic.comment.placementGridSize").translatedName("tweakeroo.config.generic.name.placementGridSize"); - public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger ("placementLimit", 3, 1, 10000, "tweakeroo.config.generic.comment.placementLimit").translatedName("tweakeroo.config.generic.name.placementLimit"); - public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList ("placementRestrictionMode", PlacementRestrictionMode.FACE, "tweakeroo.config.generic.comment.placementRestrictionMode").translatedName("tweakeroo.config.generic.name.placementRestrictionMode"); - public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean ("placementRestrictionTiedToFast", true, "tweakeroo.config.generic.comment.placementRestrictionTiedToFast").translatedName("tweakeroo.config.generic.name.placementRestrictionTiedToFast"); - public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean ("potionWarningBeneficialOnly", true, "tweakeroo.config.generic.comment.potionWarningBeneficialOnly").translatedName("tweakeroo.config.generic.name.potionWarningBeneficialOnly"); - public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger ("potionWarningThreshold", 600, 1, 1000000, "tweakeroo.config.generic.comment.potionWarningThreshold").translatedName("tweakeroo.config.generic.name.potionWarningThreshold"); - public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean ("rememberFlexibleFromClick", true, "tweakeroo.config.generic.comment.rememberFlexibleFromClick").translatedName("tweakeroo.config.generic.name.rememberFlexibleFromClick"); - public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger ("renderLimitItem", -1, -1, 10000, "tweakeroo.config.generic.comment.renderLimitItem").translatedName("tweakeroo.config.generic.name.renderLimitItem"); - public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger ("renderLimitXPOrb", -1, -1, 10000, "tweakeroo.config.generic.comment.renderLimitXPOrb").translatedName("tweakeroo.config.generic.name.renderLimitXPOrb"); - public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger ("sculkSensorPulseLength", 40, 0, 10000, "tweakeroo.config.generic.comment.sculkSensorPulseLength").translatedName("tweakeroo.config.generic.name.sculkSensorPulseLength"); - public static final ConfigInteger SERVER_NBT_REQUEST_RATE = new ConfigInteger ("serverNbtRequestRate", 2, "tweakeroo.config.generic.comment.serverNbtRequestRate").translatedName("tweakeroo.config.generic.name.serverNbtRequestRate"); - public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("shulkerDisplayBgColor", true, "tweakeroo.config.generic.comment.shulkerDisplayBgColor").translatedName("tweakeroo.config.generic.name.shulkerDisplayBgColor"); - public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("shulkerDisplayRequireShift", true, "tweakeroo.config.generic.comment.shulkerDisplayRequireShift").translatedName("tweakeroo.config.generic.name.shulkerDisplayRequireShift"); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean ("slotSyncWorkaround", true, "tweakeroo.config.generic.comment.slotSyncWorkaround").translatedName("tweakeroo.config.generic.name.slotSyncWorkaround"); - public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean ("slotSyncWorkaroundAlways", false, "tweakeroo.config.generic.comment.slotSyncWorkaroundAlways").translatedName("tweakeroo.config.generic.name.slotSyncWorkaroundAlways"); - public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean ("snapAimIndicator", true, "tweakeroo.config.generic.comment.snapAimIndicator").translatedName("tweakeroo.config.generic.name.snapAimIndicator"); - public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor ("snapAimIndicatorColor", "#603030FF", "tweakeroo.config.generic.comment.snapAimIndicatorColor").translatedName("tweakeroo.config.generic.name.snapAimIndicatorColor"); - public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList ("snapAimMode", SnapAimMode.YAW, "tweakeroo.config.generic.comment.snapAimMode").translatedName("tweakeroo.config.generic.name.snapAimMode"); - public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean ("snapAimOnlyCloseToAngle", true, "tweakeroo.config.generic.comment.snapAimOnlyCloseToAngle").translatedName("tweakeroo.config.generic.name.snapAimOnlyCloseToAngle"); - public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean ("snapAimPitchOvershoot", false, "tweakeroo.config.generic.comment.snapAimPitchOvershoot").translatedName("tweakeroo.config.generic.name.snapAimPitchOvershoot"); - public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble ("snapAimPitchStep", 12.5, 0, 90, "tweakeroo.config.generic.comment.snapAimPitchStep").translatedName("tweakeroo.config.generic.name.snapAimPitchStep"); - public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble ("snapAimThresholdPitch", 1.5, "tweakeroo.config.generic.comment.snapAimThresholdPitch").translatedName("tweakeroo.config.generic.name.snapAimThresholdPitch"); - public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble ("snapAimThresholdYaw", 5.0, "tweakeroo.config.generic.comment.snapAimThresholdYaw").translatedName("tweakeroo.config.generic.name.snapAimThresholdYaw"); - public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble ("snapAimYawStep", 45, 0, 360, "tweakeroo.config.generic.comment.snapAimYawStep").translatedName("tweakeroo.config.generic.name.snapAimYawStep"); - public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger ("structureBlockMaxSize", 128, 1, 256, "tweakeroo.config.generic.comment.structureBlockMaxSize").translatedName("tweakeroo.config.generic.name.structureBlockMaxSize"); - public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString ("toolSwitchableSlots", "1-9", "tweakeroo.config.generic.comment.toolSwitchableSlots").translatedName("tweakeroo.config.generic.name.toolSwitchableSlots"); - public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString ("toolSwitchIgnoredSlots", "", "tweakeroo.config.generic.comment.toolSwitchIgnoredSlots").translatedName("tweakeroo.config.generic.name.toolSwitchIgnoredSlots"); - public static final ConfigBoolean TOOL_SWAP_BETTER_ENCHANTS = new ConfigBoolean ("toolSwapBetterEnchants", false, "tweakeroo.config.generic.comment.toolSwapBetterEnchants").translatedName("tweakeroo.config.generic.name.toolSwapBetterEnchants"); - public static final ConfigBoolean WEAPON_SWAP_BETTER_ENCHANTS = new ConfigBoolean ("weaponSwapBetterEnchants", false, "tweakeroo.config.generic.comment.weaponSwapBetterEnchants").translatedName("tweakeroo.config.generic.name.weaponSwapBetterEnchants"); - public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean ("zoomAdjustMouseSensitivity", true, "tweakeroo.config.generic.comment.zoomAdjustMouseSensitivity").translatedName("tweakeroo.config.generic.name.zoomAdjustMouseSensitivity"); - public static final ConfigDouble ZOOM_FOV = new ConfigDouble ("zoomFov", 30, 0.01, 359.99, "tweakeroo.config.generic.comment.zoomFov").translatedName("tweakeroo.config.generic.name.zoomFov"); - public static final ConfigBoolean ZOOM_RESET_FOV_ON_ACTIVATE = new ConfigBoolean ("zoomResetFovOnActivate", true, "tweakeroo.config.generic.comment.zoomResetFovOnActivate").translatedName("tweakeroo.config.generic.name.zoomResetFovOnActivate"); + public static final ConfigOptionList ACCURATE_PLACEMENT_PROTOCOL_MODE = new ConfigOptionList ("accuratePlacementProtocolMode", EasyPlacementProtocol.AUTO).apply(GENERIC_KEY); + public static final ConfigBoolean ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("accuratePlacementProtocol", true).apply(GENERIC_KEY); + public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32).apply(GENERIC_KEY); + public static final ConfigDouble ANGEL_BLOCK_PLACEMENT_DISTANCE = new ConfigDouble ("angelBlockPlacementDistance", 3, 1, 5).apply(GENERIC_KEY); + public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 1, 64).apply(GENERIC_KEY); + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_WARN = new ConfigOptionList ("blockTypeBreakRestrictionWarn", MessageOutputType.MESSAGE).apply(GENERIC_KEY); + public static final ConfigInteger BREAKING_GRID_SIZE = new ConfigInteger ("breakingGridSize", 3, 1, 1000).apply(GENERIC_KEY); + public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE).apply(GENERIC_KEY); + public static final ConfigBoolean BUNDLE_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("bundleDisplayBgColor", true).apply(GENERIC_KEY); + public static final ConfigBoolean BUNDLE_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("bundleDisplayRequireShift", true).apply(GENERIC_KEY); + public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000").apply(GENERIC_KEY); + public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]").apply(GENERIC_KEY); + public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true).apply(GENERIC_KEY); + public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10).apply(GENERIC_KEY); + public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false).apply(GENERIC_KEY); + public static final ConfigOptionList ELYTRA_CAMERA_INDICATOR = new ConfigOptionList ("elytraCameraIndicator", ActiveMode.WITH_KEY).apply(GENERIC_KEY); + public static final ConfigDouble ENTITY_REACH_DISTANCE = new ConfigDouble ("entityReachDistance", 3.0, 1, 64).apply(GENERIC_KEY); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_WARN = new ConfigOptionList ("entityTypeAttackRestrictionWarn", MessageOutputType.MESSAGE).apply(GENERIC_KEY); + public static final ConfigInteger FAST_BLOCK_PLACEMENT_COUNT = new ConfigInteger ("fastBlockPlacementCount", 2, 1, 16).apply(GENERIC_KEY); + public static final ConfigBoolean FAST_LEFT_CLICK_ALLOW_TOOLS = new ConfigBoolean ("fastLeftClickAllowTools", false).apply(GENERIC_KEY); + public static final ConfigInteger FAST_LEFT_CLICK_COUNT = new ConfigInteger ("fastLeftClickCount", 10, 1, 64).apply(GENERIC_KEY); + public static final ConfigBoolean FAST_PLACEMENT_REMEMBER_ALWAYS = new ConfigBoolean ("fastPlacementRememberOrientation", true).apply(GENERIC_KEY); + public static final ConfigInteger FAST_RIGHT_CLICK_COUNT = new ConfigInteger ("fastRightClickCount", 10, 1, 64).apply(GENERIC_KEY); + public static final ConfigInteger FILL_CLONE_LIMIT = new ConfigInteger ("fillCloneLimit", 10000000, 1, 1000000000).apply(GENERIC_KEY); + public static final ConfigColor FLEXIBLE_PLACEMENT_OVERLAY_COLOR = new ConfigColor ("flexibleBlockPlacementOverlayColor", "#C03030F0").apply(GENERIC_KEY); + public static final ConfigDouble FLY_DECELERATION_FACTOR = new ConfigDouble ("flyDecelerationFactor", 0.4, 0.0, 1.0).apply(GENERIC_KEY); + public static final ConfigDouble FLY_SPEED_PRESET_1 = new ConfigDouble ("flySpeedPreset1", 0.01, 0, 4).apply(GENERIC_KEY); + public static final ConfigDouble FLY_SPEED_PRESET_2 = new ConfigDouble ("flySpeedPreset2", 0.064, 0, 4).apply(GENERIC_KEY); + public static final ConfigDouble FLY_SPEED_PRESET_3 = new ConfigDouble ("flySpeedPreset3", 0.128, 0, 4).apply(GENERIC_KEY); + public static final ConfigDouble FLY_SPEED_PRESET_4 = new ConfigDouble ("flySpeedPreset4", 0.32, 0, 4).apply(GENERIC_KEY); + public static final ConfigBoolean FREE_CAMERA_PLAYER_INPUTS = new ConfigBoolean ("freeCameraPlayerInputs", false).apply(GENERIC_KEY); + public static final ConfigBoolean FREE_CAMERA_PLAYER_MOVEMENT = new ConfigBoolean ("freeCameraPlayerMovement", false).apply(GENERIC_KEY); + public static final ConfigDouble GAMMA_OVERRIDE_VALUE = new ConfigDouble ("gammaOverrideValue", 16, 0, 32).apply(GENERIC_KEY); + public static final ConfigBoolean HAND_RESTOCK_PRE = new ConfigBoolean ("handRestockPre", true).apply(GENERIC_KEY); + public static final ConfigInteger HAND_RESTOCK_PRE_THRESHOLD = new ConfigInteger ("handRestockPreThreshold", 6, 1, 64).apply(GENERIC_KEY); + public static final ConfigBoolean HANGABLE_ENTITY_BYPASS_INVERSE = new ConfigBoolean ("hangableEntityBypassInverse", false).apply(GENERIC_KEY); + public static final ConfigInteger HOTBAR_SLOT_CYCLE_MAX = new ConfigInteger ("hotbarSlotCycleMax", 2, 1, 9).apply(GENERIC_KEY); + public static final ConfigInteger HOTBAR_SLOT_RANDOMIZER_MAX = new ConfigInteger ("hotbarSlotRandomizerMax", 5, 1, 9).apply(GENERIC_KEY); + public static final ConfigOptionList HOTBAR_SWAP_OVERLAY_ALIGNMENT = new ConfigOptionList ("hotbarSwapOverlayAlignment", HudAlignment.BOTTOM_RIGHT).apply(GENERIC_KEY); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_X = new ConfigInteger ("hotbarSwapOverlayOffsetX", 4).apply(GENERIC_KEY); + public static final ConfigInteger HOTBAR_SWAP_OVERLAY_OFFSET_Y = new ConfigInteger ("hotbarSwapOverlayOffsetY", 4).apply(GENERIC_KEY); + public static final ConfigInteger ITEM_SWAP_DURABILITY_THRESHOLD = new ConfigInteger ("itemSwapDurabilityThreshold", 20, 5, 10000).apply(GENERIC_KEY); + public static final ConfigBoolean ITEM_USE_PACKET_CHECK_BYPASS = new ConfigBoolean ("itemUsePacketCheckBypass", true).apply(GENERIC_KEY); + public static final ConfigBoolean MAP_PREVIEW_REQUIRE_SHIFT = new ConfigBoolean ("mapPreviewRequireShift", true).apply(GENERIC_KEY); + public static final ConfigInteger MAP_PREVIEW_SIZE = new ConfigInteger ("mapPreviewSize", 160, 16, 512).apply(GENERIC_KEY); + public static final ConfigInteger PERIODIC_ATTACK_INTERVAL = new ConfigInteger ("periodicAttackInterval", 20, 0, Integer.MAX_VALUE).apply(GENERIC_KEY); + public static final ConfigBoolean PERIODIC_ATTACK_RESET_ON_ACTIVATE = new ConfigBoolean ("periodicAttackResetIntervalOnActivate", true).apply(GENERIC_KEY); + public static final ConfigInteger PERIODIC_USE_INTERVAL = new ConfigInteger ("periodicUseInterval", 20, 0, Integer.MAX_VALUE).apply(GENERIC_KEY); + public static final ConfigBoolean PERIODIC_USE_RESET_ON_ACTIVATE = new ConfigBoolean ("periodicUseResetIntervalOnActivate", true).apply(GENERIC_KEY); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_DURATION = new ConfigInteger ("periodicHoldAttackDuration", 20, 0, Integer.MAX_VALUE).apply(GENERIC_KEY); + public static final ConfigInteger PERIODIC_HOLD_ATTACK_INTERVAL = new ConfigInteger ("periodicHoldAttackInterval", 20, 0, Integer.MAX_VALUE).apply(GENERIC_KEY); + public static final ConfigBoolean PERIODIC_HOLD_ATTACK_RESET_ON_ACTIVATE= new ConfigBoolean ("periodicHoldAttackResetIntervalOnActivate", true).apply(GENERIC_KEY); + public static final ConfigInteger PERIODIC_HOLD_USE_DURATION = new ConfigInteger ("periodicHoldUseDuration", 20, 0, Integer.MAX_VALUE).apply(GENERIC_KEY); + public static final ConfigInteger PERIODIC_HOLD_USE_INTERVAL = new ConfigInteger ("periodicHoldUseInterval", 20, 0, Integer.MAX_VALUE).apply(GENERIC_KEY); + public static final ConfigBoolean PERIODIC_HOLD_USE_RESET_ON_ACTIVATE = new ConfigBoolean ("periodicHoldUseResetIntervalOnActivate", true).apply(GENERIC_KEY); + public static final ConfigBoolean PERMANENT_SNEAK_ALLOW_IN_GUIS = new ConfigBoolean ("permanentSneakAllowInGUIs", false).apply(GENERIC_KEY); + public static final ConfigInteger PLACEMENT_GRID_SIZE = new ConfigInteger ("placementGridSize", 3, 1, 1000).apply(GENERIC_KEY); + public static final ConfigInteger PLACEMENT_LIMIT = new ConfigInteger ("placementLimit", 3, 1, 10000).apply(GENERIC_KEY); + public static final ConfigOptionList PLACEMENT_RESTRICTION_MODE = new ConfigOptionList ("placementRestrictionMode", PlacementRestrictionMode.FACE).apply(GENERIC_KEY); + public static final ConfigBoolean PLACEMENT_RESTRICTION_TIED_TO_FAST = new ConfigBoolean ("placementRestrictionTiedToFast", true).apply(GENERIC_KEY); + public static final ConfigBoolean POTION_WARNING_BENEFICIAL_ONLY = new ConfigBoolean ("potionWarningBeneficialOnly", true).apply(GENERIC_KEY); + public static final ConfigInteger POTION_WARNING_THRESHOLD = new ConfigInteger ("potionWarningThreshold", 600, 1, 1000000).apply(GENERIC_KEY); + public static final ConfigBoolean REMEMBER_FLEXIBLE = new ConfigBoolean ("rememberFlexibleFromClick", true).apply(GENERIC_KEY); + public static final ConfigInteger RENDER_LIMIT_ITEM = new ConfigInteger ("renderLimitItem", -1, -1, 10000).apply(GENERIC_KEY); + public static final ConfigInteger RENDER_LIMIT_XP_ORB = new ConfigInteger ("renderLimitXPOrb", -1, -1, 10000).apply(GENERIC_KEY); + public static final ConfigInteger SCULK_SENSOR_PULSE_LENGTH = new ConfigInteger ("sculkSensorPulseLength", 40, 0, 10000).apply(GENERIC_KEY); + public static final ConfigInteger SERVER_NBT_REQUEST_RATE = new ConfigInteger ("serverNbtRequestRate", 2).apply(GENERIC_KEY); + public static final ConfigBoolean SHULKER_DISPLAY_BACKGROUND_COLOR = new ConfigBoolean ("shulkerDisplayBgColor", true).apply(GENERIC_KEY); + public static final ConfigBoolean SHULKER_DISPLAY_REQUIRE_SHIFT = new ConfigBoolean ("shulkerDisplayRequireShift", true).apply(GENERIC_KEY); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND = new ConfigBoolean ("slotSyncWorkaround", true).apply(GENERIC_KEY); + public static final ConfigBoolean SLOT_SYNC_WORKAROUND_ALWAYS = new ConfigBoolean ("slotSyncWorkaroundAlways", false).apply(GENERIC_KEY); + public static final ConfigBoolean SNAP_AIM_INDICATOR = new ConfigBoolean ("snapAimIndicator", true).apply(GENERIC_KEY); + public static final ConfigColor SNAP_AIM_INDICATOR_COLOR = new ConfigColor ("snapAimIndicatorColor", "#603030FF").apply(GENERIC_KEY); + public static final ConfigOptionList SNAP_AIM_MODE = new ConfigOptionList ("snapAimMode", SnapAimMode.YAW).apply(GENERIC_KEY); + public static final ConfigBoolean SNAP_AIM_ONLY_CLOSE_TO_ANGLE = new ConfigBoolean ("snapAimOnlyCloseToAngle", true).apply(GENERIC_KEY); + public static final ConfigBoolean SNAP_AIM_PITCH_OVERSHOOT = new ConfigBoolean ("snapAimPitchOvershoot", false).apply(GENERIC_KEY); + public static final ConfigDouble SNAP_AIM_PITCH_STEP = new ConfigDouble ("snapAimPitchStep", 12.5, 0, 90).apply(GENERIC_KEY); + public static final ConfigDouble SNAP_AIM_THRESHOLD_PITCH = new ConfigDouble ("snapAimThresholdPitch", 1.5).apply(GENERIC_KEY); + public static final ConfigDouble SNAP_AIM_THRESHOLD_YAW = new ConfigDouble ("snapAimThresholdYaw", 5.0).apply(GENERIC_KEY); + public static final ConfigDouble SNAP_AIM_YAW_STEP = new ConfigDouble ("snapAimYawStep", 45, 0, 360).apply(GENERIC_KEY); + public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger ("structureBlockMaxSize", 128, 1, 256).apply(GENERIC_KEY); + public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString ("toolSwitchableSlots", "1-9").apply(GENERIC_KEY); + public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString ("toolSwitchIgnoredSlots", "").apply(GENERIC_KEY); + public static final ConfigBoolean TOOL_SWAP_BETTER_ENCHANTS = new ConfigBoolean ("toolSwapBetterEnchants", false).apply(GENERIC_KEY); + public static final ConfigBoolean WEAPON_SWAP_BETTER_ENCHANTS = new ConfigBoolean ("weaponSwapBetterEnchants", false).apply(GENERIC_KEY); + public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean ("zoomAdjustMouseSensitivity", true).apply(GENERIC_KEY); + public static final ConfigDouble ZOOM_FOV = new ConfigDouble ("zoomFov", 30, 0.01, 359.99).apply(GENERIC_KEY); + public static final ConfigBoolean ZOOM_RESET_FOV_ON_ACTIVATE = new ConfigBoolean ("zoomResetFovOnActivate", true).apply(GENERIC_KEY); public static final ImmutableList OPTIONS = ImmutableList.of( ACCURATE_PLACEMENT_PROTOCOL_MODE, @@ -223,12 +229,12 @@ public static class Generic public static class Fixes { - public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false, "tweakeroo.config.fixes.comment.elytraFix").translatedName("tweakeroo.config.fixes.name.elytraFix"); - public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false, "tweakeroo.config.fixes.comment.macHorizontalScroll").translatedName("tweakeroo.config.fixes.name.macHorizontalScroll"); - public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean("ravagerClientBlockBreakFix", false, "tweakeroo.config.fixes.comment.ravagerClientBlockBreakFix").translatedName("tweakeroo.config.fixes.name.ravagerClientBlockBreakFix"); + //public static final ConfigBoolean ELYTRA_FIX = new ConfigBoolean("elytraFix", false).apply(FIXES_KEY); + public static final ConfigBoolean MAC_HORIZONTAL_SCROLL = new ConfigBoolean("macHorizontalScroll", false).apply(FIXES_KEY); + public static final ConfigBoolean RAVAGER_CLIENT_BLOCK_BREAK_FIX = new ConfigBoolean("ravagerClientBlockBreakFix", false).apply(FIXES_KEY); public static final ImmutableList OPTIONS = ImmutableList.of( - ELYTRA_FIX, + //ELYTRA_FIX, MAC_HORIZONTAL_SCROLL, RAVAGER_CLIENT_BLOCK_BREAK_FIX ); @@ -236,33 +242,33 @@ public static class Fixes public static class Lists { - public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList("blockTypeBreakRestrictionListType", ListType.BLACKLIST, "tweakeroo.config.lists.comment.blockTypeBreakRestrictionListType").translatedName("tweakeroo.config.lists.name.blockTypeBreakRestrictionListType"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList("blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst"), "tweakeroo.config.lists.comment.blockTypeBreakRestrictionBlackList").translatedName("tweakeroo.config.lists.name.blockTypeBreakRestrictionBlackList"); - public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList("blockTypeBreakRestrictionWhiteList", ImmutableList.of(), "tweakeroo.config.lists.comment.blockTypeBreakRestrictionWhiteList").translatedName("tweakeroo.config.lists.name.blockTypeBreakRestrictionWhiteList"); - //public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}"), "tweakeroo.config.lists.comment.creativeExtraItems").translatedName("tweakeroo.config.lists.name.creativeExtraItems"); - public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST, "tweakeroo.config.lists.comment.entityTypeAttackRestrictionListType").translatedName("tweakeroo.config.lists.name.entityTypeAttackRestrictionListType"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), "tweakeroo.config.lists.comment.entityTypeAttackRestrictionBlackList").translatedName("tweakeroo.config.lists.name.entityTypeAttackRestrictionBlackList"); - public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of(), "tweakeroo.config.lists.comment.entityTypeAttackRestrictionWhiteList").translatedName("tweakeroo.config.lists.name.entityTypeAttackRestrictionWhiteList"); - public static final ConfigStringList PREFER_SILK_TOUCH = new ConfigStringList("preferSilkTouch", ImmutableList.of("minecraft:ender_chest"), "tweakeroo.config.lists.comment.preferSilkTouch").translatedName("tweakeroo.config.lists.name.preferSilkTouch"); - public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of(" => minecraft:mace, minecraft:netherite_sword, minecraft:diamond_sword, minecraft:iron_sword, minecraft:golden_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:mace, minecraft:netherite_axe, minecraft:diamond_axe, minecraft:iron_axe, minecraft:golden_axe, minecraft:stone_axe, minecraft:wooden_axe"), "tweakeroo.config.lists.comment.entityWeaponMapping").translatedName("tweakeroo.config.lists.name.entityWeaponMapping"); - public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList("fastPlacementItemListType", ListType.BLACKLIST, "tweakeroo.config.lists.comment.fastPlacementItemListType").translatedName("tweakeroo.config.lists.name.fastPlacementItemListType"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList("fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), "tweakeroo.config.lists.comment.fastPlacementItemBlackList").translatedName("tweakeroo.config.lists.name.fastPlacementItemBlackList"); - public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList("fastPlacementItemWhiteList", ImmutableList.of(), "tweakeroo.config.lists.comment.fastPlacementItemWhiteList").translatedName("tweakeroo.config.lists.name.fastPlacementItemWhiteList"); - public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList("fastRightClickBlockListType", ListType.BLACKLIST, "tweakeroo.config.lists.comment.fastRightClickBlockListType").translatedName("tweakeroo.config.lists.name.fastRightClickBlockListType"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList("fastRightClickBlockBlackList", ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", "minecraft:white_shulker_box"), "tweakeroo.config.lists.comment.fastRightClickBlockBlackList").translatedName("tweakeroo.config.lists.name.fastRightClickBlockBlackList"); - public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList("fastRightClickBlockWhiteList", ImmutableList.of(), "tweakeroo.config.lists.comment.fastRightClickBlockWhiteList").translatedName("tweakeroo.config.lists.name.fastRightClickBlockWhiteList"); - public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList("fastRightClickListType", ListType.NONE, "tweakeroo.config.lists.comment.fastRightClickListType").translatedName("tweakeroo.config.lists.name.fastRightClickListType"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList("fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket"), "tweakeroo.config.lists.comment.fastRightClickBlackList").translatedName("tweakeroo.config.lists.name.fastRightClickBlackList"); - public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList("fastRightClickWhiteList", ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", "minecraft:glass_bottle"), "tweakeroo.config.lists.comment.fastRightClickWhiteList").translatedName("tweakeroo.config.lists.name.fastRightClickWhiteList"); - //public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", ImmutableList.of("White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass"), "tweakeroo.config.lists.comment.flatWorldPresets").translatedName("tweakeroo.config.lists.name.flatWorldPresets"); - public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", ListType.NONE, "tweakeroo.config.lists.comment.handRestockListType").translatedName("tweakeroo.config.lists.name.handRestockListType"); - public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket"), "tweakeroo.config.lists.comment.handRestockBlackList").translatedName("tweakeroo.config.lists.name.handRestockBlackList"); - public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", ImmutableList.of(), "tweakeroo.config.lists.comment.handRestockWhiteList").translatedName("tweakeroo.config.lists.name.handRestockWhiteList"); - public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", ListType.NONE, "tweakeroo.config.lists.comment.potionWarningListType").translatedName("tweakeroo.config.lists.name.potionWarningListType"); - public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", "minecraft:slowness", "minecraft:weakness"), "tweakeroo.config.lists.comment.potionWarningBlackList").translatedName("tweakeroo.config.lists.name.potionWarningBlackList"); - public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing"), "tweakeroo.config.lists.comment.potionWarningWhiteList").translatedName("tweakeroo.config.lists.name.potionWarningWhiteList"); - public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", ImmutableList.of("mainhand", "offhand"), "tweakeroo.config.lists.comment.repairModeSlots").translatedName("tweakeroo.config.lists.name.repairModeSlots"); - public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle"), "tweakeroo.config.lists.comment.unstackingItems").translatedName("tweakeroo.config.lists.name.unstackingItems"); + public static final ConfigOptionList BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE = new ConfigOptionList("blockTypeBreakRestrictionListType", ListType.BLACKLIST).apply(LISTS_KEY); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_BLACKLIST = new ConfigStringList("blockTypeBreakRestrictionBlackList", ImmutableList.of("minecraft:budding_amethyst")).apply(LISTS_KEY); + public static final ConfigStringList BLOCK_TYPE_BREAK_RESTRICTION_WHITELIST = new ConfigStringList("blockTypeBreakRestrictionWhiteList", ImmutableList.of()).apply(LISTS_KEY); + //public static final ConfigStringList CREATIVE_EXTRA_ITEMS = new ConfigStringList("creativeExtraItems", ImmutableList.of("minecraft:command_block", "minecraft:chain_command_block", "minecraft:repeating_command_block", "minecraft:dragon_egg", "minecraft:structure_void", "minecraft:structure_block", "minecraft:structure_block{BlockEntityTag:{mode:\"SAVE\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"LOAD\"}}", "minecraft:structure_block{BlockEntityTag:{mode:\"CORNER\"}}")).apply(LISTS_KEY); + public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST).apply(LISTS_KEY); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager")).apply(LISTS_KEY); + public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of()).apply(LISTS_KEY); + public static final ConfigStringList PREFER_SILK_TOUCH = new ConfigStringList("preferSilkTouch", ImmutableList.of("minecraft:ender_chest")).apply(LISTS_KEY); + public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of(" => minecraft:mace, minecraft:netherite_sword, minecraft:diamond_sword, minecraft:iron_sword, minecraft:golden_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => ", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:mace, minecraft:netherite_axe, minecraft:diamond_axe, minecraft:iron_axe, minecraft:golden_axe, minecraft:stone_axe, minecraft:wooden_axe")).apply(LISTS_KEY); + public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList("fastPlacementItemListType", ListType.BLACKLIST).apply(LISTS_KEY); + public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList("fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box")).apply(LISTS_KEY); + public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList("fastPlacementItemWhiteList", ImmutableList.of()).apply(LISTS_KEY); + public static final ConfigOptionList FAST_RIGHT_CLICK_BLOCK_LIST_TYPE = new ConfigOptionList("fastRightClickBlockListType", ListType.BLACKLIST).apply(LISTS_KEY); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_BLACKLIST = new ConfigStringList("fastRightClickBlockBlackList", ImmutableList.of("minecraft:chest", "minecraft:ender_chest", "minecraft:trapped_chest", "minecraft:white_shulker_box")).apply(LISTS_KEY); + public static final ConfigStringList FAST_RIGHT_CLICK_BLOCK_WHITELIST = new ConfigStringList("fastRightClickBlockWhiteList", ImmutableList.of()).apply(LISTS_KEY); + public static final ConfigOptionList FAST_RIGHT_CLICK_ITEM_LIST_TYPE = new ConfigOptionList("fastRightClickListType", ListType.NONE).apply(LISTS_KEY); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_BLACKLIST = new ConfigStringList("fastRightClickBlackList", ImmutableList.of("minecraft:firework_rocket")).apply(LISTS_KEY); + public static final ConfigStringList FAST_RIGHT_CLICK_ITEM_WHITELIST = new ConfigStringList("fastRightClickWhiteList", ImmutableList.of("minecraft:bucket", "minecraft:water_bucket", "minecraft:lava_bucket", "minecraft:glass_bottle")).apply(LISTS_KEY); + //public static final ConfigStringList FLAT_WORLD_PRESETS = new ConfigStringList("flatWorldPresets", ImmutableList.of("White Glass;1*minecraft:white_stained_glass;minecraft:plains;;minecraft:white_stained_glass", "Glass;1*minecraft:glass;minecraft:plains;;minecraft:glass")).apply(LISTS_KEY); + public static final ConfigOptionList HAND_RESTOCK_LIST_TYPE = new ConfigOptionList("handRestockListType", ListType.NONE).apply(LISTS_KEY); + public static final ConfigStringList HAND_RESTOCK_BLACKLIST = new ConfigStringList("handRestockBlackList", ImmutableList.of("minecraft:bucket", "minecraft:lava_bucket", "minecraft:water_bucket")).apply(LISTS_KEY); + public static final ConfigStringList HAND_RESTOCK_WHITELIST = new ConfigStringList("handRestockWhiteList", ImmutableList.of()).apply(LISTS_KEY); + public static final ConfigOptionList POTION_WARNING_LIST_TYPE = new ConfigOptionList("potionWarningListType", ListType.NONE).apply(LISTS_KEY); + public static final ConfigStringList POTION_WARNING_BLACKLIST = new ConfigStringList("potionWarningBlackList", ImmutableList.of("minecraft:hunger", "minecraft:mining_fatigue", "minecraft:nausea", "minecraft:poison", "minecraft:slowness", "minecraft:weakness")).apply(LISTS_KEY); + public static final ConfigStringList POTION_WARNING_WHITELIST = new ConfigStringList("potionWarningWhiteList", ImmutableList.of("minecraft:fire_resistance", "minecraft:invisibility", "minecraft:water_breathing")).apply(LISTS_KEY); + public static final ConfigStringList REPAIR_MODE_SLOTS = new ConfigStringList("repairModeSlots", ImmutableList.of("mainhand", "offhand")).apply(LISTS_KEY); + public static final ConfigStringList UNSTACKING_ITEMS = new ConfigStringList("unstackingItems", ImmutableList.of("minecraft:bucket", "minecraft:glass_bottle")).apply(LISTS_KEY); public static final ImmutableList OPTIONS = ImmutableList.of( BLOCK_TYPE_BREAK_RESTRICTION_LIST_TYPE, @@ -297,51 +303,51 @@ public static class Lists public static class Disable { - public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed("disableArmorStandRendering", false, "", "tweakeroo.config.disable.comment.disableArmorStandRendering").translatedName("tweakeroo.config.disable.name.disableArmorStandRendering"); - public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed("disableAxeStripping", false, "", "tweakeroo.config.disable.comment.disableAxeStripping").translatedName("tweakeroo.config.disable.name.disableAxeStripping"); - public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient ("disableBatSpawning", false, "", "tweakeroo.config.disable.comment.disableBatSpawning").translatedName("tweakeroo.config.disable.name.disableBatSpawning"); - public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed("disableBeaconBeamRendering", false, "", "tweakeroo.config.disable.comment.disableBeaconBeamRendering").translatedName("tweakeroo.config.disable.name.disableBeaconBeamRendering"); - public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed("disableBlockBreakingParticles", false, "", "tweakeroo.config.disable.comment.disableBlockBreakingParticles").translatedName("tweakeroo.config.disable.name.disableBlockBreakingParticles"); - public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_COOLDOWN = new ConfigBooleanHotkeyed("disableBlockBreakCooldown", false, "", "tweakeroo.config.disable.comment.disableBlockBreakCooldown").translatedName("tweakeroo.config.disable.name.disableBlockBreakCooldown"); - public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "", "tweakeroo.config.disable.comment.disableDoubleTapSprint").translatedName("tweakeroo.config.disable.name.disableDoubleTapSprint"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "", "tweakeroo.config.disable.comment.disableBossBar").translatedName("tweakeroo.config.disable.name.disableBossBar"); - public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "", "tweakeroo.config.disable.comment.disableBossFog").translatedName("tweakeroo.config.disable.name.disableBossFog"); - public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "", "tweakeroo.config.disable.comment.disableChunkRendering").translatedName("tweakeroo.config.disable.name.disableChunkRendering"); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "", "tweakeroo.config.disable.comment.disableClientEntityUpdates").translatedName("tweakeroo.config.disable.name.disableClientEntityUpdates"); - public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "", "tweakeroo.config.disable.comment.disableClientLightUpdates").translatedName("tweakeroo.config.disable.name.disableClientLightUpdates"); - public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "", "tweakeroo.config.disable.comment.disableConstantChunkSaving").translatedName("tweakeroo.config.disable.name.disableConstantChunkSaving"); - public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS= new ConfigBooleanHotkeyed("disableCreativeMenuInfestedBlocks", false, "", "tweakeroo.config.disable.comment.disableCreativeMenuInfestedBlocks").translatedName("tweakeroo.config.disable.name.disableCreativeMenuInfestedBlocks"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed("disableDeadMobRendering", false, "", "tweakeroo.config.disable.comment.disableDeadMobRendering").translatedName("tweakeroo.config.disable.name.disableDeadMobRendering"); - public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed("disableDeadMobTargeting", false, "", "tweakeroo.config.disable.comment.disableDeadMobTargeting").translatedName("tweakeroo.config.disable.name.disableDeadMobTargeting"); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableEntityRendering", false, "", "tweakeroo.config.disable.comment.disableEntityRendering").translatedName("tweakeroo.config.disable.name.disableEntityRendering"); - public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient ("disableEntityTicking", false, "", "tweakeroo.config.disable.comment.disableEntityTicking").translatedName("tweakeroo.config.disable.name.disableEntityTicking"); - public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed("disableFallingBlockEntityRendering", false, "", "tweakeroo.config.disable.comment.disableFallingBlockEntityRendering").translatedName("tweakeroo.config.disable.name.disableFallingBlockEntityRendering"); - public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed("disableFirstPersonEffectParticles", false, "", "tweakeroo.config.disable.comment.disableFirstPersonEffectParticles").translatedName("tweakeroo.config.disable.name.disableFirstPersonEffectParticles"); - public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed("disableInventoryEffectRendering", false, "", "tweakeroo.config.disable.comment.disableInventoryEffectRendering").translatedName("tweakeroo.config.disable.name.disableInventoryEffectRendering"); - public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed("disableItemSwitchRenderCooldown", false, "", "tweakeroo.config.disable.comment.disableItemSwitchRenderCooldown").translatedName("tweakeroo.config.disable.name.disableItemSwitchRenderCooldown"); - public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed("disableMobSpawnerMobRendering", false, "", "tweakeroo.config.disable.comment.disableMobSpawnerMobRendering").translatedName("tweakeroo.config.disable.name.disableMobSpawnerMobRendering"); - public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed("disableNauseaEffect", false, "", "tweakeroo.config.disable.comment.disableNauseaEffect").translatedName("tweakeroo.config.disable.name.disableNauseaEffect"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", false, "", "tweakeroo.config.disable.comment.disableNetherFog").translatedName("tweakeroo.config.disable.name.disableNetherFog"); - public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed("disableNetherPortalSound", false, "", "tweakeroo.config.disable.comment.disableNetherPortalSound").translatedName("tweakeroo.config.disable.name.disableNetherPortalSound"); - public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient ("disableObserver", false, "", "tweakeroo.config.disable.comment.disableObserver").translatedName("tweakeroo.config.disable.name.disableObserver"); - public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed("disableOffhandRendering", false, "", "tweakeroo.config.disable.comment.disableOffhandRendering").translatedName("tweakeroo.config.disable.name.disableOffhandRendering"); - public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", false, "", "tweakeroo.config.disable.comment.disableParticles").translatedName("tweakeroo.config.disable.name.disableParticles"); - public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed("disablePortalGuiClosing", false, "", "tweakeroo.config.disable.comment.disablePortalGuiClosing").translatedName("tweakeroo.config.disable.name.disablePortalGuiClosing"); - public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", false, "", "tweakeroo.config.disable.comment.disableRainEffects").translatedName("tweakeroo.config.disable.name.disableRainEffects"); - public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed("disableRenderingScaffolding", false, "", "tweakeroo.config.disable.comment.disableRenderingScaffolding").translatedName("tweakeroo.config.disable.name.disableRenderingScaffolding"); - public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed("disableRenderDistanceFog", false, "", "tweakeroo.config.disable.comment.disableRenderDistanceFog").translatedName("tweakeroo.config.disable.name.disableRenderDistanceFog"); - public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed("disableScoreboardRendering", false, "", "tweakeroo.config.disable.comment.disableScoreboardRendering").translatedName("tweakeroo.config.disable.name.disableScoreboardRendering"); - public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed("disableShulkerBoxTooltip", false, "", "tweakeroo.config.disable.comment.disableShulkerBoxTooltip").translatedName("tweakeroo.config.disable.name.disableShulkerBoxTooltip"); - public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed("disableShovelPathing", false, "", "tweakeroo.config.disable.comment.disableShovelPathing").translatedName("tweakeroo.config.disable.name.disableShovelPathing"); - public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, "", "tweakeroo.config.disable.comment.disableSignGui").translatedName("tweakeroo.config.disable.name.disableSignGui"); - public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", false, "", "tweakeroo.config.disable.comment.disableSkyDarkness").translatedName("tweakeroo.config.disable.name.disableSkyDarkness"); - public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed("disableSlimeBlockSlowdown", false, "", "tweakeroo.config.disable.comment.disableSlimeBlockSlowdown").translatedName("tweakeroo.config.disable.name.disableSlimeBlockSlowdown"); - public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "", "tweakeroo.config.disable.comment.disableStatusEffectHud").translatedName("tweakeroo.config.disable.name.disableStatusEffectHud"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "", "tweakeroo.config.disable.comment.disableTileEntityRendering").translatedName("tweakeroo.config.disable.name.disableTileEntityRendering"); - public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "", "tweakeroo.config.disable.comment.disableTileEntityTicking").translatedName("tweakeroo.config.disable.name.disableTileEntityTicking"); - public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "", "tweakeroo.config.disable.comment.disableVillagerTradeLocking").translatedName("tweakeroo.config.disable.name.disableVillagerTradeLocking"); - public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "", "tweakeroo.config.disable.comment.disableWallUnsprint").translatedName("tweakeroo.config.disable.name.disableWallUnsprint"); - public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "", "tweakeroo.config.disable.comment.disableWorldViewBob").translatedName("tweakeroo.config.disable.name.disableWorldViewBob"); + public static final ConfigBooleanHotkeyed DISABLE_ARMOR_STAND_RENDERING = new ConfigBooleanHotkeyed("disableArmorStandRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_AXE_STRIPPING = new ConfigBooleanHotkeyed("disableAxeStripping", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_BAT_SPAWNING = new ConfigBooleanClient ("disableBatSpawning", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_BEACON_BEAM_RENDERING = new ConfigBooleanHotkeyed("disableBeaconBeamRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_PARTICLES = new ConfigBooleanHotkeyed("disableBlockBreakingParticles", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_BLOCK_BREAK_COOLDOWN = new ConfigBooleanHotkeyed("disableBlockBreakCooldown", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_DOUBLE_TAP_SPRINT = new ConfigBooleanHotkeyed("disableDoubleTapSprint", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_BAR = new ConfigBooleanHotkeyed("disableBossBar", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_BOSS_FOG = new ConfigBooleanHotkeyed("disableBossFog", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_CHUNK_RENDERING = new ConfigBooleanHotkeyed("disableChunkRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_ENTITY_UPDATES = new ConfigBooleanHotkeyed("disableClientEntityUpdates", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_CLIENT_LIGHT_UPDATES = new ConfigBooleanHotkeyed("disableClientLightUpdates", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_CONSTANT_CHUNK_SAVING = new ConfigBooleanHotkeyed("disableConstantChunkSaving", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_CREATIVE_INFESTED_BLOCKS= new ConfigBooleanHotkeyed("disableCreativeMenuInfestedBlocks", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_RENDERING = new ConfigBooleanHotkeyed("disableDeadMobRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_DEAD_MOB_TARGETING = new ConfigBooleanHotkeyed("disableDeadMobTargeting", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableEntityRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_ENTITY_TICKING = new ConfigBooleanClient ("disableEntityTicking", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_FALLING_BLOCK_RENDER = new ConfigBooleanHotkeyed("disableFallingBlockEntityRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_FP_EFFECT_PARTICLES = new ConfigBooleanHotkeyed("disableFirstPersonEffectParticles", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_INVENTORY_EFFECTS = new ConfigBooleanHotkeyed("disableInventoryEffectRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_ITEM_SWITCH_COOLDOWN = new ConfigBooleanHotkeyed("disableItemSwitchRenderCooldown", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_MOB_SPAWNER_MOB_RENDER = new ConfigBooleanHotkeyed("disableMobSpawnerMobRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_NAUSEA_EFFECT = new ConfigBooleanHotkeyed("disableNauseaEffect", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_FOG = new ConfigBooleanHotkeyed("disableNetherFog", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_NETHER_PORTAL_SOUND = new ConfigBooleanHotkeyed("disableNetherPortalSound", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_OBSERVER = new ConfigBooleanClient ("disableObserver", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_OFFHAND_RENDERING = new ConfigBooleanHotkeyed("disableOffhandRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_PARTICLES = new ConfigBooleanHotkeyed("disableParticles", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_PORTAL_GUI_CLOSING = new ConfigBooleanHotkeyed("disablePortalGuiClosing", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_RAIN_EFFECTS = new ConfigBooleanHotkeyed("disableRainEffects", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_RENDERING_SCAFFOLDING = new ConfigBooleanHotkeyed("disableRenderingScaffolding", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_RENDER_DISTANCE_FOG = new ConfigBooleanHotkeyed("disableRenderDistanceFog", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_SCOREBOARD_RENDERING = new ConfigBooleanHotkeyed("disableScoreboardRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_SHULKER_BOX_TOOLTIP = new ConfigBooleanHotkeyed("disableShulkerBoxTooltip", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_SHOVEL_PATHING = new ConfigBooleanHotkeyed("disableShovelPathing", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_SIGN_GUI = new ConfigBooleanHotkeyed("disableSignGui", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_SKY_DARKNESS = new ConfigBooleanHotkeyed("disableSkyDarkness", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_SLIME_BLOCK_SLOWDOWN = new ConfigBooleanHotkeyed("disableSlimeBlockSlowdown", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_STATUS_EFFECT_HUD = new ConfigBooleanHotkeyed("disableStatusEffectHud", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_RENDERING = new ConfigBooleanHotkeyed("disableTileEntityRendering", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_TILE_ENTITY_TICKING = new ConfigBooleanClient ("disableTileEntityTicking", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_VILLAGER_TRADE_LOCKING = new ConfigBooleanClient ("disableVillagerTradeLocking", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_WALL_UNSPRINT = new ConfigBooleanHotkeyed("disableWallUnsprint", false, "").apply(DISABLE_KEY); + public static final ConfigBooleanHotkeyed DISABLE_WORLD_VIEW_BOB = new ConfigBooleanHotkeyed("disableWorldViewBob", false, "").apply(DISABLE_KEY); public static final ImmutableList OPTIONS = ImmutableList.of( DISABLE_ARMOR_STAND_RENDERING, @@ -394,12 +400,12 @@ public static class Disable public static class Internal { - public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger ("flySpeedPreset", 0, 0, 3, "tweakeroo.config.internal.comment.flySpeedPreset").translatedName("tweakeroo.config.internal.name.flySpeedPreset"); - public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble ("gammaValueOriginal", 0, 0, 1, "tweakeroo.config.internal.comment.gammaValueOriginal").translatedName("tweakeroo.config.internal.name.gammaValueOriginal"); - public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger ("hotbarScrollCurrentRow", 3, 0, 3, "tweakeroo.config.internal.comment.hotbarScrollCurrentRow").translatedName("tweakeroo.config.internal.name.hotbarScrollCurrentRow"); - public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble ("slimeBlockSlipperinessOriginal", 0.8, 0, 1, "tweakeroo.config.internal.comment.slimeBlockSlipperinessOriginal").translatedName("tweakeroo.config.internal.name.slimeBlockSlipperinessOriginal"); - public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble ("snapAimLastPitch", 0, -135, 135, "tweakeroo.config.internal.comment.snapAimLastPitch").translatedName("tweakeroo.config.internal.name.snapAimLastPitch"); - public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble ("snapAimLastYaw", 0, 0, 360, "tweakeroo.config.internal.comment.snapAimLastYaw").translatedName("tweakeroo.config.internal.name.snapAimLastYaw"); + public static final ConfigInteger FLY_SPEED_PRESET = new ConfigInteger ("flySpeedPreset", 0, 0, 3).apply(INTERNAL_KEY); + public static final ConfigDouble GAMMA_VALUE_ORIGINAL = new ConfigDouble ("gammaValueOriginal", 0, 0, 1).apply(INTERNAL_KEY); + public static final ConfigInteger HOTBAR_SCROLL_CURRENT_ROW = new ConfigInteger ("hotbarScrollCurrentRow", 3, 0, 3).apply(INTERNAL_KEY); + public static final ConfigDouble SLIME_BLOCK_SLIPPERINESS_ORIGINAL = new ConfigDouble ("slimeBlockSlipperinessOriginal", 0.8, 0, 1).apply(INTERNAL_KEY); + public static final ConfigDouble SNAP_AIM_LAST_PITCH = new ConfigDouble ("snapAimLastPitch", 0, -135, 135).apply(INTERNAL_KEY); + public static final ConfigDouble SNAP_AIM_LAST_YAW = new ConfigDouble ("snapAimLastYaw", 0, 0, 360).apply(INTERNAL_KEY); public static final ImmutableList OPTIONS = ImmutableList.of( FLY_SPEED_PRESET, diff --git a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java index 5e584cc..d36d5b2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java +++ b/src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java @@ -107,6 +107,8 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable VALUES = ImmutableList.copyOf(values()); + private final static String FEATURE_KEY = Reference.ID+ ".config.feature_toggle"; + private final String name; private final String comment; private final String prettyName; @@ -120,25 +122,25 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable HOTKEY_LIST = ImmutableList.of( ACCURATE_BLOCK_PLACEMENT_IN, diff --git a/src/main/java/fi/dy/masa/tweakeroo/data/DataManager.java b/src/main/java/fi/dy/masa/tweakeroo/data/DataManager.java index 0ef4e0d..78dcf92 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/data/DataManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/data/DataManager.java @@ -11,7 +11,7 @@ public class DataManager implements IServerListener { private static final DataManager INSTANCE = new DataManager(); - public static DataManager getInstance() {return INSTANCE;} + public static DataManager getInstance() { return INSTANCE; } private boolean hasCarpetServer; private boolean hasServuxServer; @@ -21,7 +21,7 @@ public class DataManager implements IServerListener //private DynamicRegistryManager.Immutable registryManager = DynamicRegistryManager.EMPTY; private boolean hasIntegratedServer; - private DataManager() {} + private DataManager() { } public void reset(boolean isLogout) { @@ -35,7 +35,7 @@ public void reset(boolean isLogout) } //else //{ - //Tweakeroo.logger.info("DataManager#reset() - dimension change or log-in"); + //Tweakeroo.logger.info("DataManager#reset() - dimension change or log-in"); //} } @@ -65,7 +65,7 @@ public void onServerIntegratedSetup(IntegratedServer server) this.setHasIntegratedServer(true, server); } - public boolean hasIntegratedServer() {return this.hasIntegratedServer;} + public boolean hasIntegratedServer() { return this.hasIntegratedServer; } public void setHasIntegratedServer(boolean toggle, @Nullable IntegratedServer server) { @@ -85,6 +85,7 @@ public void setRegistryManager(DynamicRegistryManager.Immutable immutable) { this.registryManager = immutable; } + public DynamicRegistryManager.Immutable getRegistryManager() { return this.registryManager; diff --git a/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java b/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java index 53dd7a3..031b941 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/data/ServerDataSyncer.java @@ -2,8 +2,8 @@ import java.util.*; import java.util.concurrent.ConcurrentHashMap; +import javax.annotation.Nullable; import com.llamalad7.mixinextras.lib.apache.commons.tuple.Pair; -import org.jetbrains.annotations.Nullable; import com.mojang.datafixers.util.Either; import net.minecraft.block.BlockEntityProvider; @@ -58,7 +58,7 @@ public static ServerDataSyncer getInstance() { return INSTANCE; } - + private final static ServuxTweaksHandler HANDLER = ServuxTweaksHandler.getInstance(); private final static MinecraftClient mc = MinecraftClient.getInstance(); private int uptimeTicks = 0; @@ -402,7 +402,7 @@ public void onPacketFailure() else if (world.getBlockState(pos).getBlock() instanceof BlockEntityProvider) { if (DataManager.getInstance().hasIntegratedServer() == false && - FeatureToggle.TWEAK_SERVER_DATA_SYNC.getBooleanValue()) + FeatureToggle.TWEAK_SERVER_DATA_SYNC.getBooleanValue()) { this.pendingBlockEntitiesQueue.add(pos); } @@ -430,7 +430,7 @@ else if (world.getBlockState(pos).getBlock() instanceof BlockEntityProvider) return this.entityCache.get(entityId).getRight(); } if (DataManager.getInstance().hasIntegratedServer() == false && - FeatureToggle.TWEAK_SERVER_DATA_SYNC.getBooleanValue()) + FeatureToggle.TWEAK_SERVER_DATA_SYNC.getBooleanValue()) { this.pendingEntitiesQueue.add(entityId); } @@ -487,9 +487,9 @@ public Inventory getBlockInventory(World world, BlockPos pos, boolean useNbt) } if (stateAdj.getBlock() == state.getBlock() && - dataAdj instanceof ChestBlockEntity inv2 && - stateAdj.get(ChestBlock.CHEST_TYPE) != ChestType.SINGLE && - stateAdj.get(ChestBlock.FACING) == state.get(ChestBlock.FACING)) + dataAdj instanceof ChestBlockEntity inv2 && + stateAdj.get(ChestBlock.CHEST_TYPE) != ChestType.SINGLE && + stateAdj.get(ChestBlock.FACING) == state.get(ChestBlock.FACING)) { Inventory invRight = type == ChestType.RIGHT ? inv1 : inv2; Inventory invLeft = type == ChestType.RIGHT ? inv2 : inv1; diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java index 5df600e..ef7e98d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/InputHandler.java @@ -7,6 +7,7 @@ import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.Hand; +import net.minecraft.util.PlayerInput; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.Vec3d; @@ -331,7 +332,7 @@ else if (mc.options.rightKey.matchesKey(eventKey, scanCode)) } } - public void handleMovementKeys(Input movement) + public void handleMovementKeys(Input m) { GameOptions settings = MinecraftClient.getInstance().options; @@ -339,15 +340,13 @@ public void handleMovementKeys(Input movement) { if (this.lastSidewaysInput == LeftRight.LEFT) { - movement.movementSideways = 1; - movement.pressingLeft = true; - movement.pressingRight = false; + m.movementSideways = 1; + m.playerInput = new PlayerInput(m.playerInput.forward(), m.playerInput.backward(), true, false, m.playerInput.jump(), m.playerInput.sneak(), m.playerInput.sprint()); } else if (this.lastSidewaysInput == LeftRight.RIGHT) { - movement.movementSideways = -1; - movement.pressingLeft = false; - movement.pressingRight = true; + m.movementSideways = -1; + m.playerInput = new PlayerInput(m.playerInput.forward(), m.playerInput.backward(), false, true, m.playerInput.jump(), m.playerInput.sneak(), m.playerInput.sprint()); } } @@ -355,15 +354,13 @@ else if (this.lastSidewaysInput == LeftRight.RIGHT) { if (this.lastForwardInput == ForwardBack.FORWARD) { - movement.movementForward = 1; - movement.pressingForward = true; - movement.pressingBack = false; + m.movementForward = 1; + m.playerInput = new PlayerInput(true, false, m.playerInput.left(), m.playerInput.right(), m.playerInput.jump(), m.playerInput.sneak(), m.playerInput.sprint()); } else if (this.lastForwardInput == ForwardBack.BACK) { - movement.movementForward = -1; - movement.pressingForward = false; - movement.pressingBack = true; + m.movementForward = -1; + m.playerInput = new PlayerInput(false, true, m.playerInput.left(), m.playerInput.right(), m.playerInput.jump(), m.playerInput.sneak(), m.playerInput.sprint()); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java index a14330b..e1f886b 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/RenderHandler.java @@ -1,10 +1,13 @@ package fi.dy.masa.tweakeroo.event; -import com.mojang.blaze3d.systems.RenderSystem; import org.joml.Matrix4f; +import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; +import net.minecraft.client.render.Camera; +import net.minecraft.client.render.Fog; +import net.minecraft.client.render.Frustum; import net.minecraft.component.DataComponentTypes; import net.minecraft.entity.Entity; import net.minecraft.item.FilledMapItem; @@ -12,6 +15,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; +import net.minecraft.util.profiler.Profiler; import fi.dy.masa.malilib.gui.GuiBase; import fi.dy.masa.malilib.interfaces.IRenderer; @@ -28,10 +32,8 @@ public class RenderHandler implements IRenderer { @Override - public void onRenderGameOverlayPost(DrawContext drawContext) + public void onRenderGameOverlayPostAdvanced(DrawContext drawContext, float partialTicks, Profiler profiler, MinecraftClient mc) { - MinecraftClient mc = MinecraftClient.getInstance(); - if (FeatureToggle.TWEAK_HOTBAR_SWAP.getBooleanValue() && Hotkeys.HOTBAR_SWAP_BASE.getKeybind().isKeybindHeld()) { @@ -52,8 +54,6 @@ else if (FeatureToggle.TWEAK_HOTBAR_SCROLL.getBooleanValue() && { RenderUtils.renderInventoryOverlay(context, drawContext); } - - //RenderUtils.renderInventoryOverlay(mc, drawContext); } if (FeatureToggle.TWEAK_PLAYER_INVENTORY_PEEK.getBooleanValue() && @@ -88,7 +88,7 @@ public void onRenderTooltipLast(DrawContext drawContext, ItemStack stack, int x, if (FeatureToggle.TWEAK_MAP_PREVIEW.getBooleanValue() && (Configs.Generic.MAP_PREVIEW_REQUIRE_SHIFT.getBooleanValue() == false || GuiBase.isShiftDown())) { - fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false); + fi.dy.masa.malilib.render.RenderUtils.renderMapPreview(stack, x, y, Configs.Generic.MAP_PREVIEW_SIZE.getIntegerValue(), false, drawContext); } } else if (stack.getComponents().contains(DataComponentTypes.CONTAINER) && InventoryUtils.shulkerBoxHasItems(stack)) @@ -110,7 +110,7 @@ else if (stack.getComponents().contains(DataComponentTypes.BUNDLE_CONTENTS) && I } @Override - public void onRenderWorldLast(Matrix4f posMatrix, Matrix4f projMatrix) + public void onRenderWorldLastAdvanced(Matrix4f posMatrix, Matrix4f projMatrix, Frustum frustum, Camera camera, Fog fog, Profiler profiler) { MinecraftClient mc = MinecraftClient.getInstance(); diff --git a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java index a74421d..51988b1 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java +++ b/src/main/java/fi/dy/masa/tweakeroo/event/WorldLoadListener.java @@ -1,8 +1,10 @@ package fi.dy.masa.tweakeroo.event; import javax.annotation.Nullable; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.world.ClientWorld; + import fi.dy.masa.malilib.interfaces.IWorldLoadListener; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.data.DataManager; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinPiglinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinPiglinEntity.java index 68bdd8b..2430c14 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinPiglinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/IMixinPiglinEntity.java @@ -10,4 +10,4 @@ public interface IMixinPiglinEntity { @Accessor("inventory") SimpleInventory tweakeroo_inventory(); -} \ No newline at end of file +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java index 15cf44b..0186b17 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinAbstractSignEditScreen.java @@ -31,15 +31,13 @@ protected MixinAbstractSignEditScreen(Text textComponent) super(textComponent); } - @Shadow @Final private SignBlockEntity blockEntity; + @Shadow @Final protected SignBlockEntity blockEntity; @Shadow private SignText text; - @Shadow @Final private boolean front; - @Shadow @Final private String[] messages; @Override - public SignBlockEntity getTile() + public SignBlockEntity tweakeroo$getTile() { return this.blockEntity; } @@ -78,7 +76,7 @@ private void preventGuiOpen(CallbackInfo ci) } @Override - public void applyText(SignText text) + public void tweakeroo$applyText(SignText text) { this.text = text; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java index 35311c0..d44e3b9 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinBackgroundRenderer.java @@ -1,13 +1,18 @@ package fi.dy.masa.tweakeroo.mixin; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.*; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.mojang.blaze3d.systems.RenderSystem; +import org.joml.Vector4f; + import net.minecraft.client.MinecraftClient; import net.minecraft.client.render.BackgroundRenderer; import net.minecraft.client.render.Camera; +import net.minecraft.client.render.Fog; +import net.minecraft.client.render.FogShape; import net.minecraft.client.world.ClientWorld; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.*; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.renderer.RenderUtils; @@ -15,7 +20,7 @@ @Mixin(BackgroundRenderer.class) public abstract class MixinBackgroundRenderer { - private static boolean wasLava; + @Unique private static boolean wasLava; @ModifyConstant( method = "applyFog", @@ -55,39 +60,7 @@ private static float reduceLavaFogEnd(float original) return original; } - /* - @ModifyVariable( - method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", - slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/client/render/BackgroundRenderer$FogType;FOG_SKY:Lnet/minecraft/client/render/BackgroundRenderer$FogType;")), - at = @At(value = "STORE", opcode = Opcodes.FSTORE, ordinal = 2), ordinal = 1) - private static float overrideFogStart(float original) - { - if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) - { - return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 1.6f; - } - - return original; - } - - @ModifyVariable( - method = "applyFog(Lnet/minecraft/client/render/Camera;Lnet/minecraft/client/render/BackgroundRenderer$FogType;FZ)V", - slice = @Slice( - from = @At(value = "FIELD", target = "Lnet/minecraft/client/render/BackgroundRenderer$FogType;FOG_SKY:Lnet/minecraft/client/render/BackgroundRenderer$FogType;")), - at = @At(value = "STORE", opcode = Opcodes.FSTORE, ordinal = 3), ordinal = 2) - private static float overrideFogEnd(float original) - { - if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) - { - return Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()) * 2.0f; - } - - return original; - } - */ - - @Redirect(method = "render", + @Redirect(method = "getFogColor", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/world/ClientWorld$Properties;getHorizonShadingRatio()F")) private static float tweakeroo_disableSkyDarkness(ClientWorld.Properties props) @@ -97,21 +70,18 @@ private static float tweakeroo_disableSkyDarkness(ClientWorld.Properties props) @Inject(method = "applyFog", require = 0, - at = @At(value = "INVOKE", remap = false, - target = "Lcom/mojang/blaze3d/systems/RenderSystem;setShaderFogEnd(F)V", - shift = At.Shift.AFTER)) + at = @At(value = "RETURN", remap = false), cancellable = true) private static void disableRenderDistanceFog( - Camera camera, - BackgroundRenderer.FogType fogType, - float viewDistance, boolean thickFog, float tickDelta, CallbackInfo ci) + Camera camera, BackgroundRenderer.FogType fogType, Vector4f v, float viewDistance, boolean thickFog, float tickDelta, CallbackInfoReturnable cir) { if (Configs.Disable.DISABLE_RENDER_DISTANCE_FOG.getBooleanValue()) { if (thickFog == false && wasLava == false) { float distance = Math.max(512, MinecraftClient.getInstance().gameRenderer.getViewDistance()); - RenderSystem.setShaderFogStart(distance * 1.6F); - RenderSystem.setShaderFogEnd(distance * 2.0F); + cir.setReturnValue( + new Fog(distance * 1.6F, distance * 2.0F, FogShape.CYLINDER, + v.x, v.y, v.z, v.w)); } wasLava = false; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java index b221ea3..6bd7bbc 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinChunkBuilder_BuiltChunk.java @@ -12,7 +12,7 @@ public abstract class MixinChunkBuilder_BuiltChunk { @Inject(method = "isChunkNonEmpty", at = @At("HEAD"), cancellable = true) - private void allowEdgeChunksToRender(BlockPos pos, CallbackInfoReturnable cir) + private void allowEdgeChunksToRender(long l, CallbackInfoReturnable cir) { if (FeatureToggle.TWEAK_RENDER_EDGE_CHUNKS.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java index b59a381..bdff5c4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientCommandSource.java @@ -4,6 +4,7 @@ import java.util.Collections; import java.util.Locale; import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; @@ -42,11 +43,13 @@ private void onGetPositionSuggestions(CallbackInfoReturnable this.getEquippedStack(EquipmentSlot.CHEST).getMaxDamage() - 10) @@ -146,7 +147,6 @@ private void onFallFlyingCheckChestSlot(CallbackInfo ci) } } - @Inject(method = "onTrackedDataSet", at = @At("RETURN")) private void onStopFlying(TrackedData data, CallbackInfo ci) { @@ -154,7 +154,7 @@ private void onStopFlying(TrackedData data, CallbackInfo ci) { if (FLAGS.equals(data) && this.falling) { - if (!this.isFallFlying() && this.getEquippedStack(EquipmentSlot.CHEST).isOf(Items.ELYTRA)) + if (!this.isGliding() && this.getEquippedStack(EquipmentSlot.CHEST).isOf(Items.ELYTRA)) { if (!this.autoSwitchElytraChestplate.isEmpty() && !this.autoSwitchElytraChestplate.isOf(Items.ELYTRA)) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java index 44b24ac..745d989 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientPlayerInteractionManager.java @@ -30,7 +30,6 @@ public abstract class MixinClientPlayerInteractionManager { @Shadow @Final private MinecraftClient client; - @Shadow private int blockBreakingCooldown; @Inject(method = "interactItem", at = @At( diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java index 0a2b7f2..808777d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinClientWorld.java @@ -1,11 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; -import java.util.function.Supplier; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - +import fi.dy.masa.tweakeroo.config.Configs; import net.minecraft.block.BlockState; import net.minecraft.client.world.ClientWorld; import net.minecraft.entity.Entity; @@ -14,12 +9,13 @@ import net.minecraft.registry.RegistryKey; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.profiler.Profiler; import net.minecraft.world.MutableWorldProperties; import net.minecraft.world.World; import net.minecraft.world.dimension.DimensionType; - -import fi.dy.masa.tweakeroo.config.Configs; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @Mixin(ClientWorld.class) public abstract class MixinClientWorld extends World @@ -28,10 +24,9 @@ private MixinClientWorld(MutableWorldProperties properties, RegistryKey registryRef, DynamicRegistryManager registryManager, RegistryEntry dimension, - Supplier supplier, boolean isClient, boolean debugWorld, long seed, int maxChainedNeighborUpdates) { - super(properties, registryRef, registryManager, dimension, supplier, isClient, debugWorld, seed, maxChainedNeighborUpdates); + super(properties, registryRef, registryManager, dimension, isClient, debugWorld, seed, maxChainedNeighborUpdates); } @Inject(method = "tickEntity", at = @At("HEAD"), cancellable = true) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java index 5576e48..3e1ae43 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCommandBlockScreen.java @@ -1,12 +1,6 @@ package fi.dy.masa.tweakeroo.mixin; -import java.util.Arrays; -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.CallbackInfo; +import java.util.Collections; import net.minecraft.block.entity.CommandBlockBlockEntity; import net.minecraft.client.gui.DrawContext; @@ -17,6 +11,13 @@ import net.minecraft.client.gui.widget.TextFieldWidget; import net.minecraft.text.Text; import net.minecraft.util.math.BlockPos; +import org.spongepowered.asm.mixin.Final; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import fi.dy.masa.malilib.render.RenderUtils; import fi.dy.masa.malilib.util.StringUtils; @@ -26,18 +27,15 @@ @Mixin(CommandBlockScreen.class) public abstract class MixinCommandBlockScreen extends AbstractCommandBlockScreen { - @Shadow - @Final - private CommandBlockBlockEntity blockEntity; - + @Shadow @Final private CommandBlockBlockEntity blockEntity; @Shadow private CyclingButtonWidget modeButton; @Shadow private CyclingButtonWidget conditionalModeButton; @Shadow private CyclingButtonWidget redstoneTriggerButton; - private TextFieldWidget textFieldName; - private CyclingButtonWidget buttonUpdateExec; - private boolean updateExecValue; - private String lastName = ""; + @Unique private TextFieldWidget textFieldName; + @Unique private CyclingButtonWidget buttonUpdateExec; + @Unique private boolean updateExecValue; + @Unique private String lastName = ""; @Inject(method = "init", at = @At("RETURN")) private void addExtraFields(CallbackInfo ci) @@ -49,6 +47,11 @@ private void addExtraFields(CallbackInfo ci) int y = 158; int width = 200; + if (this.client == null || this.client.player == null) + { + return; + } + // Move the vanilla buttons a little bit tighter, otherwise the large GUI scale is a mess this.modeButton.setY(y); this.conditionalModeButton.setY(y); @@ -63,7 +66,7 @@ private void addExtraFields(CallbackInfo ci) y = 181; this.textFieldName = new TextFieldWidget(this.textRenderer, x1, y, width, 20, Text.of("")); - this.textFieldName.setText(this.blockEntity.getCommandExecutor().getCustomName().getString()); + this.textFieldName.setText(this.blockEntity.getCommandExecutor().getName().getString()); this.addSelectableChild(this.textFieldName); final TextFieldWidget tf = this.textFieldName; final BlockPos pos = this.blockEntity.getPos(); @@ -109,7 +112,7 @@ public void tick() if (this.textFieldName != null) { - String currentName = this.blockEntity.getCommandExecutor().getCustomName().getString(); + String currentName = this.blockEntity.getCommandExecutor().getName().getString(); if (currentName.equals(this.lastName) == false) { @@ -145,10 +148,11 @@ public void render(DrawContext drawContext, int mouseX, int mouseY, float partia if (this.buttonUpdateExec != null && this.buttonUpdateExec.isHovered()) { String hover = "tweakeroo.gui.button.misc.command_block.hover.update_execution"; - RenderUtils.drawHoverText(mouseX, mouseY, Arrays.asList(StringUtils.translate(hover)), drawContext); + RenderUtils.drawHoverText(mouseX, mouseY, Collections.singletonList(StringUtils.translate(hover)), drawContext); } } + @Unique private static Text getDisplayStringForCurrentStatus(boolean updateExecValue) { String translationKey = "tweakeroo.gui.button.misc.command_block.update_execution"; diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java index cefd1f1..db4d73f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinCreativeInventoryScreen.java @@ -1,10 +1,10 @@ package fi.dy.masa.tweakeroo.mixin; +import net.minecraft.client.gui.screen.ingame.HandledScreen; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.gui.screen.ingame.AbstractInventoryScreen; import net.minecraft.client.gui.screen.ingame.CreativeInventoryScreen; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.text.Text; @@ -12,7 +12,7 @@ import fi.dy.masa.tweakeroo.util.CreativeExtraItems; @Mixin(CreativeInventoryScreen.class) -public abstract class MixinCreativeInventoryScreen extends AbstractInventoryScreen +public abstract class MixinCreativeInventoryScreen extends HandledScreen { private MixinCreativeInventoryScreen(CreativeInventoryScreen.CreativeScreenHandler screenHandler, PlayerInventory playerInventory, Text text) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java index b7caac3..99bd958 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinDataQueryHandler.java @@ -1,22 +1,18 @@ package fi.dy.masa.tweakeroo.mixin; -import org.spongepowered.asm.mixin.Final; +import net.minecraft.client.network.DataQueryHandler; +import net.minecraft.nbt.NbtCompound; 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; -import net.minecraft.client.network.ClientPlayNetworkHandler; -import net.minecraft.client.network.DataQueryHandler; -import net.minecraft.nbt.NbtCompound; + import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.data.ServerDataSyncer; @Mixin(DataQueryHandler.class) public class MixinDataQueryHandler { - @Shadow @Final private ClientPlayNetworkHandler networkHandler; - @Inject( method = "handleQueryResponse", at = @At("HEAD") diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java index b7e14ff..a4ae44a 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinEntity.java @@ -2,6 +2,7 @@ import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; @@ -17,16 +18,14 @@ @Mixin(net.minecraft.entity.Entity.class) public abstract class MixinEntity { + @Shadow public abstract net.minecraft.util.math.Vec3d getVelocity(); + @Shadow public abstract void setVelocity(net.minecraft.util.math.Vec3d velocity); @Shadow private float yaw; @Shadow private float pitch; @Shadow public float prevYaw; @Shadow public float prevPitch; - - private double forcedPitch; - private double forcedYaw; - - @Shadow public abstract net.minecraft.util.math.Vec3d getVelocity(); - @Shadow public abstract void setVelocity(net.minecraft.util.math.Vec3d velocity); + @Unique private double forcedPitch; + @Unique private double forcedYaw; @Inject(method = "isInvisibleTo", at = @At("HEAD"), cancellable = true) private void overrideIsInvisibleToPlayer(net.minecraft.entity.player.PlayerEntity player, CallbackInfoReturnable cir) @@ -135,6 +134,7 @@ private void overrideYaw(double yawChange, double pitchChange, CallbackInfo ci) } } + @Unique private void updateCustomPlayerRotations(double yawChange, double pitchChange, boolean updateYaw, boolean updatePitch, float pitchLimit) { if (updateYaw) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java index c22123e..99f43f2 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer.java @@ -4,6 +4,7 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; @@ -29,10 +30,10 @@ @Mixin(value = GameRenderer.class, priority = 1001) public abstract class MixinGameRenderer { - @Shadow @Final MinecraftClient client; + @Shadow @Final private MinecraftClient client; - private float realYaw; - private float realPitch; + @Unique private float realYaw; + @Unique private float realPitch; @Inject(method = "renderWorld", at = @At("HEAD"), cancellable = true) private void onRenderWorld(CallbackInfo ci) @@ -44,15 +45,15 @@ private void onRenderWorld(CallbackInfo ci) } @Inject(method = "getFov", at = @At("HEAD"), cancellable = true) - private void applyZoom(Camera camera, float partialTicks, boolean useFOVSetting, CallbackInfoReturnable cir) + private void applyZoom(Camera camera, float tickDelta, boolean changingFov, CallbackInfoReturnable cir) { if (MiscUtils.isZoomActive()) { - cir.setReturnValue(Configs.Generic.ZOOM_FOV.getDoubleValue()); + cir.setReturnValue((float) Configs.Generic.ZOOM_FOV.getDoubleValue()); } else if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { - cir.setReturnValue((double) this.client.options.getFov().getValue()); + cir.setReturnValue((float) this.client.options.getFov().getValue()); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java index fa30642..6db8826 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinGameRenderer_ViewBob.java @@ -14,8 +14,7 @@ @Mixin(value = GameRenderer.class, priority = 999) public abstract class MixinGameRenderer_ViewBob { - @Shadow - protected abstract void bobView(MatrixStack matrices, float tickDelta); + @Shadow protected abstract void bobView(MatrixStack matrices, float tickDelta); @Redirect(method = "renderWorld", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;bobView(Lnet/minecraft/client/util/math/MatrixStack;F)V")) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHopperBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHopperBlockEntity.java index fd03b1f..f6f0141 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHopperBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinHopperBlockEntity.java @@ -46,4 +46,4 @@ private static void cancelItemMerging(ItemStack first, ItemStack second, Callbac { if (MiscUtils.isShulkerBox(first) || MiscUtils.isShulkerBox(second)) cir.setReturnValue(false); } -} \ No newline at end of file +} diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java index f3cc45c..bfbc0ff 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinItemStack.java @@ -15,8 +15,7 @@ @Mixin(ItemStack.class) public abstract class MixinItemStack { - @Shadow - public abstract Item getItem(); + @Shadow public abstract Item getItem(); @Inject(method = "getMaxCount", at = @At("RETURN"), cancellable = true) public void getMaxStackSizeStackSensitive(CallbackInfoReturnable cir) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java index a5b79f4..a197141 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinKeyboardInput.java @@ -1,13 +1,19 @@ package fi.dy.masa.tweakeroo.mixin; import org.objectweb.asm.Opcodes; + +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.At.Shift; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.client.input.Input; import net.minecraft.client.input.KeyboardInput; +import net.minecraft.client.option.GameOptions; +import net.minecraft.util.PlayerInput; + import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; @@ -16,9 +22,11 @@ @Mixin(KeyboardInput.class) public abstract class MixinKeyboardInput extends Input { + @Shadow @Final private GameOptions settings; + @Inject(method = "tick(ZF)V", at = @At( value = "FIELD", - target = "Lnet/minecraft/client/input/KeyboardInput;sneaking:Z", + target = "Lnet/minecraft/client/input/KeyboardInput;playerInput:Lnet/minecraft/util/PlayerInput;", ordinal = 0, shift = Shift.AFTER, opcode = Opcodes.PUTFIELD)) @@ -32,7 +40,7 @@ private void customMovement(boolean val1, float f, CallbackInfo ci) if (FeatureToggle.TWEAK_PERMANENT_SNEAK.getBooleanValue() && (Configs.Generic.PERMANENT_SNEAK_ALLOW_IN_GUIS.getBooleanValue() || GuiUtils.getCurrentScreen() == null)) { - this.sneaking = true; + this.playerInput = new PlayerInput(this.settings.forwardKey.isPressed(), this.settings.backKey.isPressed(), this.settings.leftKey.isPressed(), this.settings.rightKey.isPressed(), this.settings.jumpKey.isPressed(), true, this.settings.sprintKey.isPressed()); } } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java index 2f6ad20..8a4f746 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinLivingEntity.java @@ -1,23 +1,22 @@ package fi.dy.masa.tweakeroo.mixin; -import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.option.Perspective; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Hand; +import net.minecraft.world.World; 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.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.network.ClientPlayerEntity; -import net.minecraft.client.option.Perspective; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityType; -import net.minecraft.entity.LivingEntity; -import net.minecraft.world.World; + import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks; import fi.dy.masa.tweakeroo.util.MiscUtils; @Mixin(LivingEntity.class) @@ -30,12 +29,15 @@ private MixinLivingEntity(EntityType type, World worldIn) super(type, worldIn); } - @Redirect(method = "travel", at = @At(value = "FIELD", ordinal = 1, + // TODO 1.21.2+ - it seems that Mojang fixed this. + /* + @Redirect(method = "method_61417", at = @At(value = "FIELD", ordinal = 1, target = "Lnet/minecraft/world/World;isClient:Z")) - private boolean fixElytraLanding(World world) + private boolean fixElytraLanding() { - return world.isClient && (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || ((Object) this instanceof ClientPlayerEntity) == false); + return this.getWorld().isClient && (Configs.Fixes.ELYTRA_FIX.getBooleanValue() == false || ((Object) this instanceof ClientPlayerEntity) == false); } + */ @Inject(method = "tickStatusEffects", at = @At(value = "INVOKE", ordinal = 0, target = "Lnet/minecraft/entity/data/DataTracker;get(Lnet/minecraft/entity/data/TrackedData;)Ljava/lang/Object;"), @@ -52,7 +54,7 @@ private void removeOwnPotionEffects(CallbackInfo ci) } @Inject(method = "tickMovement", at = @At(value = "INVOKE", - target = "Lnet/minecraft/entity/LivingEntity;tickFallFlying()V")) + target = "Lnet/minecraft/entity/LivingEntity;isGliding()Z")) private void tweakeroo_applyCustomDeceleration(CallbackInfo ci) { if (FeatureToggle.TWEAK_CUSTOM_FLY_DECELERATION.getBooleanValue() && diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java index 4bbdee5..5ca85ab 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinMinecraftClient.java @@ -34,12 +34,8 @@ public abstract class MixinMinecraftClient implements IMinecraftClientInvoker @Shadow @Final public GameOptions options; @Shadow private int itemUseCooldown; @Shadow protected int attackCooldown; - - @Shadow - private boolean doAttack() { return false; } - - @Shadow - private void doItemUse() {} + @Shadow private boolean doAttack() { return false; } + @Shadow private void doItemUse() {} @Override public void tweakeroo_setItemUseCooldown(int value) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java index 377dc98..cfd5685 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinObserverBlock.java @@ -1,14 +1,16 @@ package fi.dy.masa.tweakeroo.mixin; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import net.minecraft.block.Block; import net.minecraft.block.FacingBlock; import net.minecraft.block.ObserverBlock; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldAccess; +import net.minecraft.world.WorldView; +import net.minecraft.world.tick.ScheduledTickView; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import fi.dy.masa.tweakeroo.config.Configs; @Mixin(value = ObserverBlock.class, priority = 1001) @@ -20,7 +22,7 @@ public MixinObserverBlock(Block.Settings builder) } @Inject(method = "scheduleTick", at = @At("HEAD"), cancellable = true) - private void preventTrigger(WorldAccess worldIn, BlockPos pos, CallbackInfo ci) + private void preventTrigger(WorldView world, ScheduledTickView tickView, BlockPos pos, CallbackInfo ci) { if (Configs.Disable.DISABLE_OBSERVER.getBooleanValue()) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java index 446f46a..3b82d78 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinPresetsScreen.java @@ -3,18 +3,18 @@ //@Mixin(PresetsScreen.class) public abstract class MixinPresetsScreen { - /* - @Shadow @Final private static RegistryKey BIOME_KEY; - - @Shadow @Final private CustomizeFlatLevelScreen parent; + //@Shadow @Final private static RegistryKey BIOME_KEY; + //@Shadow @Final private CustomizeFlatLevelScreen parent; + /* @Inject(method = "init", at = @At("HEAD")) - private void addCustomEntries(CallbackInfo ci) + private void tweakeroo_addCustomEntries(CallbackInfo ci) { + // FIXME if (FeatureToggle.TWEAK_CUSTOM_FLAT_PRESETS.getBooleanValue()) { + ** int vanillaEntries = 9; - int toRemove = PRESETS.size() - vanillaEntries; if (toRemove > 0) @@ -34,85 +34,8 @@ private void addCustomEntries(CallbackInfo ci) PRESETS.add(0, o); } } + ** } } - - private boolean registerPresetFromString(String str) - { - Matcher matcher = MiscUtils.PATTERN_WORLD_PRESET.matcher(str); - - if (matcher.matches()) - { - // TODO --> I added some code here, and added the IMixinCustomizeFlatLevelScreen - GeneratorOptionsHolder generatorOptionsHolder = ((IMixinCustomizeFlatLevelScreen) this.parent).tweakeroo_getCreateWorldParent().getWorldCreator().getGeneratorOptionsHolder(); - DynamicRegistryManager.Immutable dynamicRegistryManager = generatorOptionsHolder.getCombinedRegistryManager(); - //FeatureSet featureSet = generatorOptionsHolder.dataConfiguration().enabledFeatures(); - RegistryWrapper.Impl biomeLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.BIOME); - RegistryWrapper.Impl structureLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.STRUCTURE_SET); - RegistryWrapper.Impl featuresLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.PLACED_FEATURE); - //RegistryWrapper.Impl blockLookup = dynamicRegistryManager.getWrapperOrThrow(RegistryKeys.BLOCK).withFeatureFilter(featureSet); - FlatChunkGeneratorConfig defaultConfig = FlatChunkGeneratorConfig.getDefaultConfig(biomeLookup, structureLookup, featuresLookup); - //FlatChunkGeneratorConfig currentConfig = this.parent.getConfig(); - Optional> optBiomeEntry = Optional.empty(); - - String name = matcher.group("name"); - String blocksString = matcher.group("blocks"); - String biomeName = matcher.group("biome"); - // TODO add back the features - String iconItemName = matcher.group("icon"); - - RegistryKey biome = null; - - try - { - optBiomeEntry = dynamicRegistryManager.get(RegistryKeys.BIOME).getEntry(Identifier.ofVanilla(biomeName)); - biome = optBiomeEntry.flatMap(RegistryEntry.Reference::getKey).orElseThrow(); - } - catch (Exception ignore) {} - - if (biome == null) - { - Tweakeroo.logger.error("Invalid biome while parsing flat world string: '{}'", biomeName); - return false; - } - - Item item = null; - - try - { - item = Registries.ITEM.get(Identifier.of(iconItemName)); - } - catch (Exception ignore) {} - - if (item == null) - { - Tweakeroo.logger.error("Invalid item for icon while parsing flat world string: '{}'", iconItemName); - return false; - } - - List layers = MiscTweaks.parseBlockString(blocksString); - - if (layers == null) - { - Tweakeroo.logger.error("Failed to get the layers for the flat world preset"); - return false; - } - FlatChunkGeneratorConfig newConfig = defaultConfig.with(layers, defaultConfig.getStructureOverrides(), optBiomeEntry.orElseThrow()); - - //new PresetsScreen.SuperflatPresetsListWidget.SuperflatPresetEntry(null); - //addPreset(Text.translatable(name), item, biome, ImmutableSet.of(), false, false, layers); - - // TODO --> This might work (Test Me) - //this.parent.setConfig(newConfig); - - return true; - } - else - { - Tweakeroo.logger.error("Flat world preset string did not match the regex"); - } - - return false; - } */ } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java index 9b0bee2..6ceed35 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinSignBlockEntity.java @@ -44,7 +44,7 @@ private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup re if (mc.currentScreen instanceof SignEditScreen || mc.currentScreen instanceof HangingSignEditScreen) { - if (((IGuiEditSign) mc.currentScreen).getTile() == (Object) this) + if (((IGuiEditSign) mc.currentScreen).tweakeroo$getTile() == (Object) this) { MiscUtils.applyPreviousTextToSign((SignBlockEntity) (Object) this, null, ((SignBlockEntity) (Object) this).isPlayerFacingFront(mc.player)); } @@ -53,7 +53,7 @@ private void restoreCopiedText(NbtCompound nbt, RegistryWrapper.WrapperLookup re } @Override - public SignText getText(boolean front) + public SignText tweakeroo$getText(boolean front) { return front ? this.frontText : this.backText; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java index 5b87f9a..fef72fe 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinStructureBlockBlockEntity.java @@ -66,7 +66,7 @@ private void overrideCornerBlockScan(BlockPos start, BlockPos end, CallbackInfoR final int maxZ = pos.getZ() + maxSize + maxOffset + 2; final int minY = Math.max(world.getBottomY() , pos.getY() - maxSize - maxOffset - 2); - final int maxY = Math.min(world.getTopY() - 1, pos.getY() + maxSize + maxOffset + 2); + final int maxY = Math.min(world.getTopYInclusive(), pos.getY() + maxSize + maxOffset + 2); List positions = new ArrayList<>(); for (int cz = minZ >> 4; cz <= (maxZ >> 4); ++cz) diff --git a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java index 668415b..136c643 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java +++ b/src/main/java/fi/dy/masa/tweakeroo/mixin/MixinWorldRenderer.java @@ -2,16 +2,21 @@ import org.joml.Matrix4f; import org.objectweb.asm.Opcodes; + +import net.minecraft.client.MinecraftClient; +import net.minecraft.client.render.*; +import net.minecraft.client.util.ObjectAllocator; +import net.minecraft.entity.Entity; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; +import org.spongepowered.asm.mixin.Unique; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Redirect; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import net.minecraft.client.MinecraftClient; -import net.minecraft.client.render.*; -import net.minecraft.entity.Entity; -import net.minecraft.util.math.MathHelper; + import fi.dy.masa.tweakeroo.config.Configs; import fi.dy.masa.tweakeroo.config.FeatureToggle; import fi.dy.masa.tweakeroo.util.CameraUtils; @@ -22,20 +27,11 @@ public abstract class MixinWorldRenderer @Shadow private int cameraChunkX; @Shadow private int cameraChunkZ; - private int lastUpdatePosX; - private int lastUpdatePosZ; - - @Inject(method = "tickRainSplashing", at = @At("HEAD"), cancellable = true) // renderRain - private void cancelRainRender(Camera camera, CallbackInfo ci) - { - if (Configs.Disable.DISABLE_RAIN_EFFECTS.getBooleanValue()) - { - ci.cancel(); - } - } + @Unique private int lastUpdatePosX; + @Unique private int lastUpdatePosZ; @Inject(method = "renderWeather", at = @At("HEAD"), cancellable = true) - private void cancelRainRender(LightmapTextureManager lightmap, float partialTicks, double x, double y, double z, CallbackInfo ci) + private void cancelRainRender(FrameGraphBuilder frameGraphBuilder, LightmapTextureManager lightmapTextureManager, Vec3d vec3d, float f, Fog fog, CallbackInfo ci) { if (Configs.Disable.DISABLE_RAIN_EFFECTS.getBooleanValue()) { @@ -45,7 +41,9 @@ private void cancelRainRender(LightmapTextureManager lightmap, float partialTick @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=terrain_setup")) - private void preSetupTerrain(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void preSetupTerrain(ObjectAllocator objectAllocator, RenderTickCounter tickCounter, boolean bl, + Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, + Matrix4f positionMatrix, Matrix4f projectionMatrix, CallbackInfo ci) { if (FeatureToggle.TWEAK_FREE_CAMERA.getBooleanValue()) { @@ -55,13 +53,15 @@ private void preSetupTerrain(RenderTickCounter tickCounter, boolean renderBlockO @Inject(method = "render", at = @At(value = "INVOKE_STRING", target = "Lnet/minecraft/util/profiler/Profiler;swap(Ljava/lang/String;)V", args = "ldc=compile_sections")) - private void postSetupTerrain(RenderTickCounter tickCounter, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) + private void postSetupTerrain(ObjectAllocator objectAllocator, RenderTickCounter tickCounter, boolean bl, + Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, + Matrix4f positionMatrix, Matrix4f projectionMatrix, CallbackInfo ci) { CameraUtils.setFreeCameraSpectator(false); } // Allow rendering the client player entity by spoofing one of the entity rendering conditions while in Free Camera mode - @Redirect(method = "render", require = 0, at = @At(value = "INVOKE", + @Redirect(method = "getEntitiesToRender", require = 0, at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/Camera;getFocusedEntity()Lnet/minecraft/entity/Entity;", ordinal = 3)) private Entity allowRenderingClientPlayerInFreeCameraMode(Camera camera) { @@ -93,7 +93,7 @@ private void rebuildChunksAroundCamera1( // rendering seems to work fine with Sodium without these anyway @Inject(method = "setupTerrain", require = 0, at = @At(value = "INVOKE", shift = At.Shift.AFTER, - target = "Lnet/minecraft/client/render/BuiltChunkStorage;updateCameraPosition(DD)V")) + target = "Lnet/minecraft/client/render/BuiltChunkStorage;updateCameraPosition(Lnet/minecraft/util/math/ChunkSectionPos;)V")) private void rebuildChunksAroundCamera2( Camera camera, Frustum frustum, boolean hasForcedFrustum, boolean spectator, CallbackInfo ci) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java index 6656691..f1b88db 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/renderer/RenderUtils.java @@ -31,6 +31,7 @@ import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.math.MathHelper; +import fi.dy.masa.malilib.config.HudAlignment; import fi.dy.masa.malilib.render.InventoryOverlay; import fi.dy.masa.malilib.util.BlockUtils; import fi.dy.masa.malilib.util.GuiUtils; @@ -59,7 +60,7 @@ public static void renderHotbarSwapOverlay(MinecraftClient mc, DrawContext drawC int startX = offX; int startY = offY; - fi.dy.masa.malilib.config.HudAlignment align = (fi.dy.masa.malilib.config.HudAlignment) Configs.Generic.HOTBAR_SWAP_OVERLAY_ALIGNMENT.getOptionListValue(); + HudAlignment align = (HudAlignment) Configs.Generic.HOTBAR_SWAP_OVERLAY_ALIGNMENT.getOptionListValue(); switch (align) { @@ -102,7 +103,7 @@ public static void renderHotbarSwapOverlay(MinecraftClient mc, DrawContext drawC if (stack.isEmpty() == false) { - fi.dy.masa.malilib.render.InventoryOverlay.renderStackAt(stack, x, y, 1, mc, drawContext); + InventoryOverlay.renderStackAt(stack, x, y, 1, mc, drawContext); } x += 18; @@ -116,172 +117,6 @@ public static void renderHotbarSwapOverlay(MinecraftClient mc, DrawContext drawC } } - /* - public static void renderInventoryOverlay(MinecraftClient mc, DrawContext drawContext) - { - World world = fi.dy.masa.malilib.util.WorldUtils.getBestWorld(mc); - Entity cameraEntity = EntityUtils.getCameraEntity(); - - if (mc.player == null) - { - return; - } - - if (cameraEntity == mc.player && world instanceof ServerWorld) - { - // We need to get the player from the server world (if available, ie. in single player), - // so that the player itself won't be included in the ray trace - Entity serverPlayer = world.getPlayerByUuid(mc.player.getUuid()); - - if (serverPlayer != null) - { - cameraEntity = serverPlayer; - } - } - - HitResult trace = RayTraceUtils.getRayTraceFromEntity(world, cameraEntity, false); - - Inventory inv = null; - ShulkerBoxBlock shulkerBoxBlock = null; - //CrafterBlock crafterBlock = null; - LivingEntity entityLivingBase = null; - - if (trace.getType() == HitResult.Type.BLOCK) - { - BlockPos pos = ((BlockHitResult) trace).getBlockPos(); - Block blockTmp = world.getBlockState(pos).getBlock(); - - if (blockTmp instanceof ShulkerBoxBlock) - { - shulkerBoxBlock = (ShulkerBoxBlock) blockTmp; - } - - inv = fi.dy.masa.malilib.util.InventoryUtils.getInventory(world, pos); - - if (world.isClient && world.getBlockState(pos).getBlock() instanceof BlockEntityProvider - && FeatureToggle.TWEAK_SERVER_DATA_SYNC.getBooleanValue()) - { - inv = ServerDataSyncer.getInstance().getBlockInventory(world, pos); - } - } - else if (trace.getType() == HitResult.Type.ENTITY) - { - Entity entity = ((EntityHitResult) trace).getEntity(); - - if (entity.getWorld().isClient && - FeatureToggle.TWEAK_SERVER_DATA_SYNC.getBooleanValue()) - { - Entity serverEntity = ServerDataSyncer.getInstance().getServerEntity(entity); - if (serverEntity != null) - { - entity = serverEntity; - } - } - - if (entity instanceof LivingEntity) - { - entityLivingBase = (LivingEntity) entity; - } - - if (entity instanceof Inventory) - { - inv = (Inventory) entity; - } - else if (entity instanceof VillagerEntity) - { - inv = ((VillagerEntity) entity).getInventory(); - } - else if (entity instanceof AbstractHorseEntity) - { - inv = ((IMixinAbstractHorseEntity) entity).tweakeroo_getHorseInventory(); - } - } - - final boolean isWolf = (entityLivingBase instanceof WolfEntity); - final int xCenter = GuiUtils.getScaledWindowWidth() / 2; - final int yCenter = GuiUtils.getScaledWindowHeight() / 2; - int x = xCenter - 52 / 2; - int y = yCenter - 92; - - if (inv != null && inv.size() > 0) - { - final boolean isHorse = (entityLivingBase instanceof AbstractHorseEntity); - final int totalSlots = isHorse ? inv.size() - 1 : inv.size(); - final int firstSlot = isHorse ? 1 : 0; - - final fi.dy.masa.malilib.render.InventoryOverlay.InventoryRenderType type = (entityLivingBase instanceof VillagerEntity) ? fi.dy.masa.malilib.render.InventoryOverlay.InventoryRenderType.VILLAGER : fi.dy.masa.malilib.render.InventoryOverlay.getInventoryType(inv); - final fi.dy.masa.malilib.render.InventoryOverlay.InventoryProperties props = fi.dy.masa.malilib.render.InventoryOverlay.getInventoryPropsTemp(type, totalSlots); - final int rows = (int) Math.ceil((double) totalSlots / props.slotsPerRow); - int xInv = xCenter - (props.width / 2); - int yInv = yCenter - props.height - 6; - - if (rows > 6) - { - yInv -= (rows - 6) * 18; - y -= (rows - 6) * 18; - } - - if (entityLivingBase != null) - { - x = xCenter - 55; - xInv = xCenter + 2; - yInv = Math.min(yInv, yCenter - 92); - } - - fi.dy.masa.malilib.render.RenderUtils.setShulkerboxBackgroundTintColor(shulkerBoxBlock, Configs.Generic.SHULKER_DISPLAY_BACKGROUND_COLOR.getBooleanValue()); - - if (isHorse) - { - Inventory horseInv = new SimpleInventory(2); - ItemStack horseArmor = (((AbstractHorseEntity) entityLivingBase).getBodyArmor()); - horseInv.setStack(0, horseArmor != null && !horseArmor.isEmpty() ? horseArmor : ItemStack.EMPTY); - horseInv.setStack(1, inv.getStack(0)); - - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, xInv, yInv, 1, 2, mc); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, 1, 0, 2, mc, drawContext); - xInv += 32 + 4; - } - - if (totalSlots > 0) - { - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, xInv, yInv, props.slotsPerRow, totalSlots, mc); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, inv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, props.slotsPerRow, firstSlot, totalSlots, mc, drawContext); - } - } - - if (isWolf) - { - InventoryOverlay.InventoryRenderType type = InventoryOverlay.InventoryRenderType.HORSE; - final fi.dy.masa.malilib.render.InventoryOverlay.InventoryProperties props = fi.dy.masa.malilib.render.InventoryOverlay.getInventoryPropsTemp(type, 2); - final int rows = (int) Math.ceil((double) 2 / props.slotsPerRow); - int xInv; - int yInv = yCenter - props.height - 6; - - if (rows > 6) - { - yInv -= (rows - 6) * 18; - y -= (rows - 6) * 18; - } - - x = xCenter - 55; - xInv = xCenter + 2; - yInv = Math.min(yInv, yCenter - 92); - - Inventory wolfInv = new SimpleInventory(2); - ItemStack wolfArmor = ((WolfEntity) entityLivingBase).getBodyArmor(); - wolfInv.setStack(0, wolfArmor != null && !wolfArmor.isEmpty() ? wolfArmor : ItemStack.EMPTY); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, xInv, yInv, 1, 2, mc); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, wolfInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, 1, 0, 2, mc, drawContext); - } - - if (entityLivingBase != null) - { - fi.dy.masa.malilib.render.InventoryOverlay.renderEquipmentOverlayBackground(x, y, entityLivingBase, drawContext); - fi.dy.masa.malilib.render.InventoryOverlay.renderEquipmentStacks(entityLivingBase, x, y, mc, drawContext); - } - } - */ - public static void renderInventoryOverlay(InventoryOverlay.Context context, DrawContext drawContext) { MinecraftClient mc = MinecraftClient.getInstance(); @@ -317,6 +152,7 @@ else if (context.entity() != null) final int yCenter = GuiUtils.getScaledWindowHeight() / 2; int x = xCenter - 52 / 2; int y = yCenter - 92; + if (inv != null && inv.size() > 0) { final boolean isHorse = (entityLivingBase instanceof AbstractHorseEntity); @@ -335,6 +171,7 @@ else if (context.entity() != null) yInv -= (rows - 6) * 18; y -= (rows - 6) * 18; } + if (entityLivingBase != null) { x = xCenter - 55; @@ -369,16 +206,6 @@ else if (context.nbt() != null) horseInv.setStack(1, inv.getStack(0)); InventoryOverlay.renderInventoryBackground(type, xInv, yInv, 1, 2, mc); - /* - if (type == InventoryOverlay.InventoryRenderType.LLAMA) - { - InventoryOverlay.renderLlamaArmorBackgroundSlots(horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, drawContext); - } - else - { - InventoryOverlay.renderHorseArmorBackgroundSlots(horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, drawContext); - } - */ InventoryOverlay.renderInventoryStacks(type, horseInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, 1, 0, 2, mc, drawContext); xInv += 32 + 4; } @@ -386,12 +213,6 @@ else if (context.nbt() != null) if (totalSlots > 0) { InventoryOverlay.renderInventoryBackground(type, xInv, yInv, props.slotsPerRow, totalSlots, mc); - /* - if (type == InventoryOverlay.InventoryRenderType.BREWING_STAND) - { - InventoryOverlay.renderBrewerBackgroundSlots(inv, xInv, yInv, drawContext); - } - */ InventoryOverlay.renderInventoryStacks(type, inv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, props.slotsPerRow, firstSlot, totalSlots, lockedSlots, mc, drawContext); } } @@ -403,19 +224,21 @@ else if (context.nbt() != null) final int rows = (int) Math.ceil((double) 2 / props.slotsPerRow); int xInv; int yInv = yCenter - props.height - 6; + if (rows > 6) { yInv -= (rows - 6) * 18; y -= (rows - 6) * 18; } + x = xCenter - 55; xInv = xCenter + 2; yInv = Math.min(yInv, yCenter - 92); + Inventory wolfInv = new SimpleInventory(2); ItemStack wolfArmor = ((WolfEntity) entityLivingBase).getBodyArmor(); wolfInv.setStack(0, wolfArmor != null && !wolfArmor.isEmpty() ? wolfArmor : ItemStack.EMPTY); InventoryOverlay.renderInventoryBackground(type, xInv, yInv, 1, 2, mc); - //InventoryOverlay.renderWolfArmorBackgroundSlots(wolfInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, drawContext); InventoryOverlay.renderInventoryStacks(type, wolfInv, xInv + props.slotOffsetX, yInv + props.slotOffsetY, 1, 0, 2, mc, drawContext); } @@ -439,12 +262,12 @@ public static void renderPlayerInventoryOverlay(MinecraftClient mc, DrawContext int y = GuiUtils.getScaledWindowHeight() / 2 + 10; int slotOffsetX = 8; int slotOffsetY = 8; - fi.dy.masa.malilib.render.InventoryOverlay.InventoryRenderType type = fi.dy.masa.malilib.render.InventoryOverlay.InventoryRenderType.GENERIC; + InventoryOverlay.InventoryRenderType type = InventoryOverlay.InventoryRenderType.GENERIC; fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, x, y, 9, 27, mc); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, inv, x + slotOffsetX, y + slotOffsetY, 9, 9, 27, mc, drawContext); + InventoryOverlay.renderInventoryBackground(type, x, y, 9, 27, mc); + InventoryOverlay.renderInventoryStacks(type, inv, x + slotOffsetX, y + slotOffsetY, 9, 9, 27, mc, drawContext); } public static void renderHotbarScrollOverlay(MinecraftClient mc, DrawContext drawContext) @@ -460,17 +283,17 @@ public static void renderHotbarScrollOverlay(MinecraftClient mc, DrawContext dra final int yCenter = GuiUtils.getScaledWindowHeight() / 2; final int x = xCenter - 176 / 2; final int y = yCenter + 6; - fi.dy.masa.malilib.render.InventoryOverlay.InventoryRenderType type = fi.dy.masa.malilib.render.InventoryOverlay.InventoryRenderType.GENERIC; + InventoryOverlay.InventoryRenderType type = InventoryOverlay.InventoryRenderType.GENERIC; fi.dy.masa.malilib.render.RenderUtils.color(1f, 1f, 1f, 1f); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, x, y , 9, 27, mc); - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryBackground(type, x, y + 70, 9, 9, mc); + InventoryOverlay.renderInventoryBackground(type, x, y , 9, 27, mc); + InventoryOverlay.renderInventoryBackground(type, x, y + 70, 9, 9, mc); // Main inventory - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, inv, x + 8, y + 8, 9, 9, 27, mc, drawContext); + InventoryOverlay.renderInventoryStacks(type, inv, x + 8, y + 8, 9, 9, 27, mc, drawContext); // Hotbar - fi.dy.masa.malilib.render.InventoryOverlay.renderInventoryStacks(type, inv, x + 8, y + 78, 9, 0, 9, mc, drawContext); + InventoryOverlay.renderInventoryStacks(type, inv, x + 8, y + 78, 9, 0, 9, mc, drawContext); int currentRow = Configs.Internal.HOTBAR_SCROLL_CURRENT_ROW.getIntegerValue(); fi.dy.masa.malilib.render.RenderUtils.drawOutline(x + 5, y + currentRow * 18 + 5, 9 * 18 + 4, 22, 2, 0xFFFF2020); @@ -543,11 +366,9 @@ public static void renderDirectionsCursor(DrawContext drawContext) matrix4fStack.rotateX(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(-pitch)); matrix4fStack.rotateY(fi.dy.masa.malilib.render.RenderUtils.matrix4fRotateFix(yaw)); matrix4fStack.scale(-1.0F, -1.0F, -1.0F); - - RenderSystem.applyModelViewMatrix(); RenderSystem.renderCrosshair(10); matrix4fStack.popMatrix(); - RenderSystem.applyModelViewMatrix(); + //RenderSystem.applyModelViewMatrix(); RenderSystem.disableBlend(); } @@ -653,6 +474,11 @@ private static void renderSnapAimAngleIndicatorPitch(int xCenter, int yCenter, i public static void renderPitchLockIndicator(MinecraftClient mc, DrawContext drawContext) { + if (mc.player == null) + { + return; + } + final int xCenter = GuiUtils.getScaledWindowWidth() / 2; final int yCenter = GuiUtils.getScaledWindowHeight() / 2; int width = 12; diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java index 76ab666..ab29478 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/MiscTweaks.java @@ -1,10 +1,7 @@ package fi.dy.masa.tweakeroo.tweaks; import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.List; +import java.util.*; import java.util.function.Consumer; import org.jetbrains.annotations.NotNull; import net.minecraft.block.Block; @@ -16,6 +13,7 @@ import net.minecraft.entity.effect.StatusEffectInstance; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.Identifier; import net.minecraft.world.gen.chunk.FlatChunkGeneratorLayer; import fi.dy.masa.malilib.config.IConfigBoolean; @@ -333,8 +331,15 @@ private static Block getBlockFromName(String name) { try { - Identifier identifier = Identifier.tryParse(name); - return Registries.BLOCK.getOrEmpty(identifier).orElse(null); + //return Registries.BLOCK.getOrEmpty(identifier).orElse(null); + Optional> opt = Registries.BLOCK.getEntry(Identifier.tryParse(name)); + + if (opt.isPresent()) + { + return opt.get().value(); + } + + return null; } catch (Exception e) { diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java index 53ceb4f..07a968f 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementHandler.java @@ -12,7 +12,7 @@ import net.minecraft.client.MinecraftClient; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemPlacementContext; -import net.minecraft.state.property.DirectionProperty; +import net.minecraft.state.property.EnumProperty; import net.minecraft.state.property.Properties; import net.minecraft.state.property.Property; import net.minecraft.util.Hand; @@ -124,7 +124,7 @@ public static BlockState applyPlacementProtocolV2(BlockState state, UseContext c return state; } - @Nullable DirectionProperty property = fi.dy.masa.malilib.util.BlockUtils.getFirstDirectionProperty(state); + @Nullable EnumProperty property = fi.dy.masa.malilib.util.BlockUtils.getFirstDirectionProperty(state); if (property != null) { @@ -187,7 +187,7 @@ public static > BlockState applyPlacementProtocolV3(Bloc return oldState; } - @Nullable DirectionProperty property = fi.dy.masa.malilib.util.BlockUtils.getFirstDirectionProperty(state); + @Nullable EnumProperty property = fi.dy.masa.malilib.util.BlockUtils.getFirstDirectionProperty(state); // DirectionProperty - allow all except: VERTICAL_DIRECTION (PointedDripstone) if (property != null && property != Properties.VERTICAL_DIRECTION) @@ -224,7 +224,7 @@ public static > BlockState applyPlacementProtocolV3(Bloc { for (Property p : propList) { - if ((p instanceof DirectionProperty) == false && + if (((p instanceof EnumProperty ep) && ep.getType().equals(Direction.class) == false) && WHITELISTED_PROPERTIES.contains(p)) { @SuppressWarnings("unchecked") @@ -282,7 +282,7 @@ public static > BlockState applyPlacementProtocolV3(Bloc } private static BlockState applyDirectionProperty(BlockState state, UseContext context, - DirectionProperty property, int protocolValue) + EnumProperty property, int protocolValue) { Direction facingOrig = state.get(property); Direction facing = facingOrig; diff --git a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java index 0253ce5..a4bb1c4 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java +++ b/src/main/java/fi/dy/masa/tweakeroo/tweaks/PlacementTweaks.java @@ -1,12 +1,18 @@ package fi.dy.masa.tweakeroo.tweaks; -import javax.annotation.Nullable; -import java.util.Arrays; -import java.util.List; +import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.util.*; +import fi.dy.masa.malilib.util.PositionUtils.HitPart; +import fi.dy.masa.malilib.util.restrictions.BlockRestriction; +import fi.dy.masa.malilib.util.restrictions.ItemRestriction; +import fi.dy.masa.tweakeroo.config.Configs; +import fi.dy.masa.tweakeroo.config.FeatureToggle; +import fi.dy.masa.tweakeroo.config.Hotkeys; +import fi.dy.masa.tweakeroo.util.InventoryUtils; +import fi.dy.masa.tweakeroo.util.*; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; -import net.minecraft.block.enums.Orientation; import net.minecraft.client.MinecraftClient; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.client.network.ClientPlayerInteractionManager; @@ -16,9 +22,6 @@ import net.minecraft.item.*; import net.minecraft.network.packet.c2s.play.PlayerMoveC2SPacket; import net.minecraft.screen.ScreenHandler; -import net.minecraft.state.property.DirectionProperty; -import net.minecraft.state.property.Properties; -import net.minecraft.state.property.Property; import net.minecraft.util.ActionResult; import net.minecraft.util.Hand; import net.minecraft.util.hit.BlockHitResult; @@ -28,16 +31,8 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import fi.dy.masa.malilib.gui.Message; -import fi.dy.masa.malilib.util.*; -import fi.dy.masa.malilib.util.PositionUtils.HitPart; -import fi.dy.masa.malilib.util.restrictions.BlockRestriction; -import fi.dy.masa.malilib.util.restrictions.ItemRestriction; -import fi.dy.masa.tweakeroo.config.Configs; -import fi.dy.masa.tweakeroo.config.FeatureToggle; -import fi.dy.masa.tweakeroo.config.Hotkeys; -import fi.dy.masa.tweakeroo.util.InventoryUtils; -import fi.dy.masa.tweakeroo.util.*; + +import javax.annotation.Nullable; public class PlacementTweaks { @@ -546,13 +541,13 @@ else if (flexible == false || rotation == false) double x = hitVec.x; int afterClickerClickCount = MathHelper.clamp(Configs.Generic.AFTER_CLICKER_CLICK_COUNT.getIntegerValue(), 0, 32); - if (handleAccurate && isFacingValidFor(facing, stack)) + if (handleAccurate && BlockUtils.isFacingValidForDirection(stack, facing)) { x = posNew.getX() + relX + 2 + (facing.getId() * 2); } - else if (handleAccurate && isFacingValidForOrientation(facing, stack)) + else if (handleAccurate && BlockUtils.isFacingValidForOrientation(stack, facing)) { - int facingIndex = getOrientationFacingIndex(stack, facing); + int facingIndex = BlockUtils.getOrientationFacingIndex(stack, facing); if (facingIndex > 0) { @@ -633,10 +628,7 @@ private static boolean canPlaceBlockAgainst(World world, BlockPos pos, PlayerEnt ItemStack stackClicked = state.getBlock().getPickStack(world, pos, state); ItemStack stackHand = player.getStackInHand(hand); - if (fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand) == false) - { - return false; - } + return fi.dy.masa.malilib.util.InventoryUtils.areStacksEqual(stackClicked, stackHand); } return true; @@ -691,6 +683,7 @@ public static void tryRestockHand(PlayerEntity player, Hand hand, ItemStack stac // Don't allow taking stacks from elsewhere in the hotbar, if the cycle tweak is on boolean allowHotbar = FeatureToggle.TWEAK_HOTBAR_SLOT_CYCLE.getBooleanValue() == false && FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue() == false; + InventoryUtils.restockNewStackToHand(player, hand, stackOriginal, allowHotbar); } } @@ -768,7 +761,7 @@ private static ActionResult processRightClickBlockWrapper( // Carpet-Extra mod accurate block placement protocol support if (flexible && rotation && accurate == false && Configs.Generic.ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && - isFacingValidFor(facing, stackOriginal)) + BlockUtils.isFacingValidForDirection(stackOriginal, facing)) { facing = facing.getOpposite(); // go from block face to click on to the requested facing //double relX = hitVecIn.x - posIn.getX(); @@ -784,14 +777,14 @@ private static ActionResult processRightClickBlockWrapper( hitVecIn = new Vec3d(x, hitVecIn.y, hitVecIn.z); } else if (flexible && rotation && accurate == false && - Configs.Generic.ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && - isFacingValidForOrientation(facing, stackOriginal)) + Configs.Generic.ACCURATE_PLACEMENT_PROTOCOL.getBooleanValue() && + BlockUtils.isFacingValidForOrientation(stackOriginal, facing)) { facing = facing.getOpposite(); // go from block face to click on to the requested facing //double relX = hitVecIn.x - posIn.getX(); //double x = posIn.getX() + relX + 2 + (facing.getId() * 2); - int facingIndex = getOrientationFacingIndex(stackOriginal, facing); + int facingIndex = BlockUtils.getOrientationFacingIndex(stackOriginal, facing); double x; if (facingIndex >= 0) { @@ -884,8 +877,7 @@ else if (flexible && rotation && accurate == false && } else if (FeatureToggle.TWEAK_HOTBAR_SLOT_RANDOMIZER.getBooleanValue()) { - int newSlot = player.getRandom().nextInt(Configs.Generic.HOTBAR_SLOT_RANDOMIZER_MAX.getIntegerValue()); - inv.selectedSlot = newSlot; + inv.selectedSlot = player.getRandom().nextInt(Configs.Generic.HOTBAR_SLOT_RANDOMIZER_MAX.getIntegerValue()); } } @@ -923,13 +915,13 @@ else if (hitPart == HitPart.RIGHT) float yaw = facing.asRotation(); float pitch = player.getPitch(); player.setYaw(yaw); - player.networkHandler.send(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround())); + player.networkHandler.send(new PlayerMoveC2SPacket.LookAndOnGround(yaw, pitch, player.isOnGround(), player.horizontalCollision)); //System.out.printf("handleFlexibleBlockPlacement() pos: %s, side: %s, facing orig: %s facing new: %s\n", pos, side, facingOrig, facing); ActionResult result = processRightClickBlockWrapper(controller, player, world, pos, side, hitVec, hand); player.setYaw(yawOrig); - player.networkHandler.send(new PlayerMoveC2SPacket.LookAndOnGround(yawOrig, pitch, player.isOnGround())); + player.networkHandler.send(new PlayerMoveC2SPacket.LookAndOnGround(yawOrig, pitch, player.isOnGround(), player.horizontalCollision)); return result; } @@ -959,27 +951,25 @@ private static Direction getRotatedFacing(Direction originalSide, Direction play { if (originalSide.getAxis().isVertical()) { - switch (hitPart) + return switch (hitPart) { - case LEFT: return playerFacingH.rotateYClockwise(); - case RIGHT: return playerFacingH.rotateYCounterclockwise(); - case BOTTOM: return originalSide == Direction.UP ? playerFacingH : playerFacingH.getOpposite(); - case TOP: return originalSide == Direction.DOWN ? playerFacingH : playerFacingH.getOpposite(); - case CENTER: return originalSide.getOpposite(); - default: return originalSide; - } + case LEFT -> playerFacingH.rotateYClockwise(); + case RIGHT -> playerFacingH.rotateYCounterclockwise(); + case BOTTOM -> originalSide == Direction.UP ? playerFacingH : playerFacingH.getOpposite(); + case TOP -> originalSide == Direction.DOWN ? playerFacingH : playerFacingH.getOpposite(); + case CENTER -> originalSide.getOpposite(); + }; } else { - switch (hitPart) + return switch (hitPart) { - case LEFT: return originalSide.rotateYCounterclockwise(); - case RIGHT: return originalSide.rotateYClockwise(); - case BOTTOM: return Direction.UP; - case TOP: return Direction.DOWN; - case CENTER: return originalSide.getOpposite(); - default: return originalSide; - } + case LEFT -> originalSide.rotateYCounterclockwise(); + case RIGHT -> originalSide.rotateYClockwise(); + case BOTTOM -> Direction.UP; + case TOP -> Direction.DOWN; + case CENTER -> originalSide.getOpposite(); + }; } } @@ -1054,16 +1044,15 @@ private static boolean isPositionAllowedByRestrictions(BlockPos pos, Direction s if (restrictionEnabled) { - switch (mode) + return switch (mode) { - case COLUMN: return isNewPositionValidForColumnMode(pos, posFirst, sideFirst); - case DIAGONAL: return isNewPositionValidForDiagonalMode(pos, posFirst, sideFirst); - case FACE: return isNewPositionValidForFaceMode(pos, side, sideFirst); - case LAYER: return isNewPositionValidForLayerMode(pos, posFirst, sideFirst); - case LINE: return isNewPositionValidForLineMode(pos, posFirst, sideFirst); - case PLANE: return isNewPositionValidForPlaneMode(pos, posFirst, sideFirst); - default: return true; - } + case COLUMN -> isNewPositionValidForColumnMode(pos, posFirst, sideFirst); + case DIAGONAL -> isNewPositionValidForDiagonalMode(pos, posFirst, sideFirst); + case FACE -> isNewPositionValidForFaceMode(pos, side, sideFirst); + case LAYER -> isNewPositionValidForLayerMode(pos, posFirst, sideFirst); + case LINE -> isNewPositionValidForLineMode(pos, posFirst, sideFirst); + case PLANE -> isNewPositionValidForPlaneMode(pos, posFirst, sideFirst); + }; } else { @@ -1071,67 +1060,6 @@ private static boolean isPositionAllowedByRestrictions(BlockPos pos, Direction s } } - private static boolean isFacingValidFor(Direction facing, ItemStack stack) - { - Item item = stack.getItem(); - - if (stack.isEmpty() == false && item instanceof BlockItem) - { - Block block = ((BlockItem) item).getBlock(); - BlockState state = block.getDefaultState(); - - for (Property prop : state.getProperties()) - { - if (prop instanceof DirectionProperty) - { - return ((DirectionProperty) prop).getValues().contains(facing); - } - } - } - - return false; - } - - private static boolean isFacingValidForOrientation(Direction facing, ItemStack stack) - { - Item item = stack.getItem(); - - if (stack.isEmpty() == false && item instanceof BlockItem) - { - Block block = ((BlockItem) item).getBlock(); - BlockState state = block.getDefaultState(); - - return state.contains(Properties.ORIENTATION); - } - - return false; - } - - private static int getOrientationFacingIndex(ItemStack stackIn, Direction facing) - { - if (stackIn.getItem() instanceof BlockItem blockItem) - { - BlockState defaultState = blockItem.getBlock().getDefaultState(); - - if (defaultState.contains(Properties.ORIENTATION)) - { - List list = Arrays.stream(Orientation.values()).toList(); - - for (int i = 0; i < list.size(); i++) - { - Orientation o = list.get(i); - - if (o.getFacing().equals(facing)) - { - return i; - } - } - } - } - - return -1; - } - private static BlockPos getPlacementPositionForTargetedPosition(World world, BlockPos pos, Direction side, ItemPlacementContext useContext) { if (canPlaceBlockIntoPosition(world, pos, useContext)) @@ -1146,6 +1074,7 @@ private static BlockPos getPlacementPositionForTargetedPosition(World world, Blo private static boolean canPlaceBlockIntoPosition(World world, BlockPos pos, ItemPlacementContext useContext) { BlockState state = world.getBlockState(pos); + // FIXME - state.getFluidState().equals(Fluids.EMPTY.getDefaultState()) -- could work return state.canReplace(useContext) || state.isLiquid() || state.isReplaceable(); } @@ -1153,15 +1082,12 @@ private static boolean isNewPositionValidForColumnMode(BlockPos posNew, BlockPos { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) + return switch (axis) { - case X: return posNew.getY() == posFirst.getY() && posNew.getZ() == posFirst.getZ(); - case Y: return posNew.getX() == posFirst.getX() && posNew.getZ() == posFirst.getZ(); - case Z: return posNew.getX() == posFirst.getX() && posNew.getY() == posFirst.getY(); - - default: - return false; - } + case X -> posNew.getY() == posFirst.getY() && posNew.getZ() == posFirst.getZ(); + case Y -> posNew.getX() == posFirst.getX() && posNew.getZ() == posFirst.getZ(); + case Z -> posNew.getX() == posFirst.getX() && posNew.getY() == posFirst.getY(); + }; } private static boolean isNewPositionValidForDiagonalMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) @@ -1169,15 +1095,12 @@ private static boolean isNewPositionValidForDiagonalMode(BlockPos posNew, BlockP Direction.Axis axis = sideFirst.getAxis(); BlockPos relativePos = posNew.subtract(posFirst); - switch (axis) + return switch (axis) { - case X: return posNew.getX() == posFirst.getX() && Math.abs(relativePos.getY()) == Math.abs(relativePos.getZ()); - case Y: return posNew.getY() == posFirst.getY() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getZ()); - case Z: return posNew.getZ() == posFirst.getZ() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getY()); - - default: - return false; - } + case X -> posNew.getX() == posFirst.getX() && Math.abs(relativePos.getY()) == Math.abs(relativePos.getZ()); + case Y -> posNew.getY() == posFirst.getY() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getZ()); + case Z -> posNew.getZ() == posFirst.getZ() && Math.abs(relativePos.getX()) == Math.abs(relativePos.getY()); + }; } private static boolean isNewPositionValidForFaceMode(BlockPos posNew, Direction side, Direction sideFirst) @@ -1194,30 +1117,24 @@ private static boolean isNewPositionValidForLineMode(BlockPos posNew, BlockPos p { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) + return switch (axis) { - case X: return posNew.getX() == posFirst.getX() && (posNew.getY() == posFirst.getY() || posNew.getZ() == posFirst.getZ()); - case Y: return posNew.getY() == posFirst.getY() && (posNew.getX() == posFirst.getX() || posNew.getZ() == posFirst.getZ()); - case Z: return posNew.getZ() == posFirst.getZ() && (posNew.getX() == posFirst.getX() || posNew.getY() == posFirst.getY()); - - default: - return false; - } + case X -> posNew.getX() == posFirst.getX() && (posNew.getY() == posFirst.getY() || posNew.getZ() == posFirst.getZ()); + case Y -> posNew.getY() == posFirst.getY() && (posNew.getX() == posFirst.getX() || posNew.getZ() == posFirst.getZ()); + case Z -> posNew.getZ() == posFirst.getZ() && (posNew.getX() == posFirst.getX() || posNew.getY() == posFirst.getY()); + }; } private static boolean isNewPositionValidForPlaneMode(BlockPos posNew, BlockPos posFirst, Direction sideFirst) { Direction.Axis axis = sideFirst.getAxis(); - switch (axis) + return switch (axis) { - case X: return posNew.getX() == posFirst.getX(); - case Y: return posNew.getY() == posFirst.getY(); - case Z: return posNew.getZ() == posFirst.getZ(); - - default: - return false; - } + case X -> posNew.getX() == posFirst.getX(); + case Y -> posNew.getY() == posFirst.getY(); + case Z -> posNew.getZ() == posFirst.getZ(); + }; } /* @@ -1296,11 +1213,7 @@ public static boolean shouldSkipSlotSync(int slotNumber, ItemStack newStack) return true; } - if (mc.options.attackKey.isPressed() && - FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue()) - { - return true; - } + return mc.options.attackKey.isPressed() && FeatureToggle.TWEAK_FAST_LEFT_CLICK.getBooleanValue(); } return false; diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/CameraUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/CameraUtils.java index 94301a2..0170a53 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/CameraUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/CameraUtils.java @@ -126,9 +126,15 @@ public static void markChunksForRebuild(int chunkX, int chunkZ, int lastChunkX, public static void markChunksForRebuildOnDeactivation(int lastChunkX, int lastChunkZ) { - Entity entity = EntityUtils.getCameraEntity(); MinecraftClient mc = MinecraftClient.getInstance(); final int viewDistance = mc.options.getViewDistance().getValue(); + Entity entity = EntityUtils.getCameraEntity(); + + if (mc.world == null || entity == null) + { + return; + } + final int chunkX = MathHelper.floor(entity.getX() / 16.0) >> 4; final int chunkZ = MathHelper.floor(entity.getZ() / 16.0) >> 4; @@ -159,7 +165,7 @@ public static void markChunkForReRender(WorldRenderer renderer, int chunkX, int { for (int cy = 0; cy < 16; ++cy) { - renderer.scheduleBlockRender(chunkX, cy, chunkZ); + renderer.scheduleChunkRender(chunkX, cy, chunkZ); } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java b/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java index c4dcd70..9f2afec 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/EntityRestriction.java @@ -5,6 +5,7 @@ import java.util.Set; import net.minecraft.entity.EntityType; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.Identifier; import fi.dy.masa.malilib.util.restrictions.UsageRestriction; import fi.dy.masa.tweakeroo.Tweakeroo; @@ -18,10 +19,11 @@ protected void setValuesForList(Set> set, List names) { try { - Optional> entityType = Registries.ENTITY_TYPE.getOrEmpty(Identifier.tryParse(name)); - if (entityType.isPresent()) + Optional>> opt = Registries.ENTITY_TYPE.getEntry(Identifier.tryParse(name)); + + if (opt.isPresent()) { - set.add(entityType.get()); + set.add(opt.get().value()); continue; } } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java b/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java index 2d979b7..556179d 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/IGuiEditSign.java @@ -5,7 +5,7 @@ public interface IGuiEditSign { - SignBlockEntity getTile(); + SignBlockEntity tweakeroo$getTile(); - void applyText(SignText text); + void tweakeroo$applyText(SignText text); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java b/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java index 02e5ef4..9c4c2fb 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/ISignTextAccess.java @@ -4,5 +4,5 @@ public interface ISignTextAccess { - SignText getText(boolean front); + SignText tweakeroo$getText(boolean front); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java index 949f56a..fbfb202 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/InventoryUtils.java @@ -23,10 +23,16 @@ import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; +import net.minecraft.inventory.Inventories; +import net.minecraft.inventory.Inventory; +import net.minecraft.inventory.SimpleInventory; import net.minecraft.item.*; +import net.minecraft.nbt.NbtCompound; +import net.minecraft.nbt.NbtList; import net.minecraft.network.packet.c2s.play.UpdateSelectedSlotC2SPacket; import net.minecraft.registry.Registries; import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryWrapper; import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.registry.tag.EnchantmentTags; import net.minecraft.screen.PlayerScreenHandler; @@ -35,6 +41,7 @@ import net.minecraft.screen.slot.SlotActionType; import net.minecraft.util.Hand; import net.minecraft.util.Identifier; +import net.minecraft.util.collection.DefaultedList; import net.minecraft.util.hit.BlockHitResult; import net.minecraft.util.hit.HitResult; import net.minecraft.util.math.BlockPos; @@ -42,6 +49,7 @@ import net.minecraft.util.math.intprovider.UniformIntProvider; import net.minecraft.world.World; import fi.dy.masa.malilib.gui.Message; +import fi.dy.masa.malilib.util.Constants; import fi.dy.masa.malilib.util.GuiUtils; import fi.dy.masa.malilib.util.InfoUtils; import fi.dy.masa.tweakeroo.Tweakeroo; @@ -136,11 +144,12 @@ public static void setUnstackingItems(List names) { try { - Item item = Registries.ITEM.get(Identifier.tryParse(name)); + //Item item = Registries.ITEM.get(Identifier.tryParse(name)); + Optional> opt = Registries.ITEM.getEntry(Identifier.tryParse(name)); - if (item != null && item != Items.AIR) + if (opt.isPresent() && opt.get().value() != Items.AIR) { - UNSTACKING_ITEMS.add(item); + UNSTACKING_ITEMS.add(opt.get().value()); } } catch (Exception e) @@ -207,11 +216,11 @@ public static void setWeaponMapping(List mappings) { try { - Optional weapon = Registries.ITEM.getOrEmpty(Identifier.tryParse(itemId)); + Optional> opt = Registries.ITEM.getEntry(Identifier.tryParse(itemId)); - if (weapon.isPresent()) + if (opt.isPresent()) { - weapons.add(weapon.get()); + weapons.add(opt.get().value()); continue; } } @@ -231,11 +240,11 @@ public static void setWeaponMapping(List mappings) { try { - Optional> entity = Registries.ENTITY_TYPE.getOrEmpty(Identifier.tryParse(entity_id)); + Optional>> opt = Registries.ENTITY_TYPE.getEntry(Identifier.tryParse(entity_id)); - if (entity.isPresent()) + if (opt.isPresent()) { - WEAPON_MAPPING.computeIfAbsent(entity.get(), s -> new HashSet<>()).addAll(weapons); + WEAPON_MAPPING.computeIfAbsent(opt.get().value(), s -> new HashSet<>()).addAll(weapons); continue; } } @@ -487,7 +496,7 @@ private static float getBaseAttackDamage(ItemStack stack) for (AttributeModifiersComponent.Entry entry : modifiers) { - if (entry.attribute().equals(EntityAttributes.GENERIC_ATTACK_DAMAGE)) + if (entry.attribute().equals(EntityAttributes.ATTACK_DAMAGE)) { return (float) entry.modifier().value(); } @@ -897,7 +906,10 @@ public static void equipBestElytra(PlayerEntity player) ScreenHandler container = player.currentScreenHandler; - Predicate filter = (s) -> s.getItem() instanceof ElytraItem && ElytraItem.isUsable(s) && s.getDamage() < s.getMaxDamage() - 10; + Predicate filter = (s) -> s.getItem().equals(Items.ELYTRA) && + s.get(DataComponentTypes.EQUIPPABLE).allows(EntityType.PLAYER) && + s.getDamage() < s.getMaxDamage() - 10; + int targetSlot = findSlotWithBestItemMatch(container, (testedStack, previousBestMatch) -> { if (!filter.test(testedStack)) return false; if (!filter.test(previousBestMatch)) return true; @@ -928,7 +940,9 @@ public static void swapElytraAndChestPlate(@Nullable PlayerEntity player) ScreenHandler container = player.currentScreenHandler; ItemStack currentStack = player.getEquippedStack(EquipmentSlot.CHEST); - Predicate stackFilterChestPlate = (s) -> s.getItem() instanceof ArmorItem && ((ArmorItem) s.getItem()).getSlotType() == EquipmentSlot.CHEST; + Predicate stackFilterChestPlate = (s) -> s.getItem() instanceof ArmorItem && + //((ArmorItem) s.getItem()).getSlotType() == EquipmentSlot.CHEST; + s.get(DataComponentTypes.EQUIPPABLE).slot() == EquipmentSlot.CHEST; if (currentStack.isEmpty() || stackFilterChestPlate.test(currentStack)) { @@ -964,8 +978,8 @@ private static double getArmorAndArmorToughnessValue(ItemStack stack, double bas final double[] total = {base}; stack.applyAttributeModifier(slot, (entry, modifier) -> { - if (entry.getKey().orElseThrow() == EntityAttributes.GENERIC_ARMOR - || entry.getKey().orElseThrow() == EntityAttributes.GENERIC_ARMOR_TOUGHNESS) + if (entry.getKey().orElseThrow() == EntityAttributes.ARMOR + || entry.getKey().orElseThrow() == EntityAttributes.ARMOR_TOUGHNESS) { switch (modifier.operation()) { @@ -1126,7 +1140,7 @@ private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection< return currentHotbarSlot; } - if ((stack.getItem() instanceof ToolItem) == false) + if ((stack.getItem() instanceof MiningToolItem) == false) { nonTool = currentHotbarSlot; } @@ -1141,7 +1155,7 @@ private static int getUsableHotbarSlotForTool(int currentHotbarSlot, Collection< return hotbarSlot; } - if (nonTool == -1 && (stack.getItem() instanceof ToolItem) == false) + if (nonTool == -1 && (stack.getItem() instanceof MiningToolItem) == false) { nonTool = hotbarSlot; } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java b/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java index c10aabc..019028e 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/ItemRestriction.java @@ -2,10 +2,13 @@ import java.util.HashSet; import java.util.List; +import java.util.Optional; + import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.Identifier; import fi.dy.masa.malilib.util.restrictions.UsageRestriction.ListType; import fi.dy.masa.tweakeroo.Tweakeroo; @@ -32,11 +35,12 @@ protected void setValuesForList(ListType type, List names) { try { - Item item = Registries.ITEM.get(Identifier.tryParse(name)); + //Item item = Registries.ITEM.get(Identifier.tryParse(name)); + Optional> opt = Registries.ITEM.getEntry(Identifier.tryParse(name)); - if (item != null && item != Items.AIR) + if (opt.isPresent() && opt.get().value() != Items.AIR) { - set.add(item); + set.add(opt.get().value()); } else { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java index 8fad117..393b842 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/MiscUtils.java @@ -100,7 +100,8 @@ public static void handlePlayerDeceleration() ClientPlayerEntity player = mc.player; Input input = player.input; - if (input.jumping || input.sneaking || + //if (input.jumping || input.sneaking || + if (input.playerInput.jump() || input.playerInput.sneak() || player.forwardSpeed != 0 || player.sidewaysSpeed != 0 || player.getAbilities().flying == false) { return; @@ -420,7 +421,7 @@ public static int getChatBackgroundColor(int colorOrig) public static void copyTextFromSign(SignBlockEntity te, boolean front) { - previousSignText = ((ISignTextAccess) te).getText(front); + previousSignText = ((ISignTextAccess) te).tweakeroo$getText(front); } public static void applyPreviousTextToSign(SignBlockEntity te, @Nullable AbstractSignEditScreen guiLines, boolean front) @@ -430,7 +431,7 @@ public static void applyPreviousTextToSign(SignBlockEntity te, @Nullable Abstrac te.setText(previousSignText, front); if (guiLines != null) { - ((IGuiEditSign) guiLines).applyText(previousSignText); + ((IGuiEditSign) guiLines).tweakeroo$applyText(previousSignText); } } } @@ -481,9 +482,12 @@ public static void rightClickEntity(Entity entity, MinecraftClient mc, PlayerEnt actionResult = mc.interactionManager.interactEntity(player, entity, hand); } - if (actionResult.isAccepted() && actionResult.shouldSwingHand()) + if (actionResult instanceof ActionResult.Success success) { - player.swingHand(hand); + if (success.swingSource() == ActionResult.SwingSource.CLIENT) + { + player.swingHand(hand); + } } } @@ -707,10 +711,10 @@ public static boolean registerPresetFromString(CustomizeFlatLevelScreen screen, GeneratorOptionsHolder generatorOptionsHolder = ((IMixinCustomizeFlatLevelScreen) screen).tweakeroo_getCreateWorldParent().getWorldCreator().getGeneratorOptionsHolder(); DynamicRegistryManager.Immutable registryManager = generatorOptionsHolder.getCombinedRegistryManager(); FeatureSet featureSet = generatorOptionsHolder.dataConfiguration().enabledFeatures(); - RegistryEntryLookup biomeLookup = registryManager.get(RegistryKeys.BIOME).getReadOnlyWrapper(); - RegistryEntryLookup structureLookup = registryManager.get(RegistryKeys.STRUCTURE_SET).getReadOnlyWrapper();; - RegistryEntryLookup featuresLookup = registryManager.get(RegistryKeys.PLACED_FEATURE).getReadOnlyWrapper();; - RegistryEntryLookup blockLookup = registryManager.get(RegistryKeys.BLOCK).getReadOnlyWrapper(); + RegistryEntryLookup biomeLookup = registryManager.getOrThrow(RegistryKeys.BIOME); + RegistryEntryLookup structureLookup = registryManager.getOrThrow(RegistryKeys.STRUCTURE_SET); + RegistryEntryLookup featuresLookup = registryManager.getOrThrow(RegistryKeys.PLACED_FEATURE); + RegistryEntryLookup blockLookup = registryManager.getOrThrow(RegistryKeys.BLOCK).withFeatureFilter(featureSet); FlatChunkGeneratorConfig defaultConfig = FlatChunkGeneratorConfig.getDefaultConfig(biomeLookup, structureLookup, featuresLookup); FlatChunkGeneratorConfig currentConfig = screen.getConfig(); RegistryEntry.Reference referenceEntry = biomeLookup.getOrThrow(BiomeKeys.PLAINS); @@ -725,7 +729,7 @@ public static boolean registerPresetFromString(CustomizeFlatLevelScreen screen, try { Optional> optBiome = Optional.ofNullable(Identifier.tryParse(biomeName)).map((biomeId) -> - RegistryKey.of(RegistryKeys.BIOME, biomeId)); + RegistryKey.of(RegistryKeys.BIOME, biomeId)); biomeEntry = optBiome.flatMap(biomeLookup::getOptional).orElse(referenceEntry); } diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java b/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java index 9be99b2..1f340ec 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/PotionRestriction.java @@ -1,9 +1,11 @@ package fi.dy.masa.tweakeroo.util; import java.util.List; +import java.util.Optional; import java.util.Set; import net.minecraft.entity.effect.StatusEffect; import net.minecraft.registry.Registries; +import net.minecraft.registry.entry.RegistryEntry; import net.minecraft.util.Identifier; import fi.dy.masa.malilib.util.restrictions.UsageRestriction; import fi.dy.masa.tweakeroo.Tweakeroo; @@ -23,11 +25,12 @@ protected void setValuesForList(Set set, List names) } catch (Exception ignored) { } - StatusEffect effect = rl != null ? Registries.STATUS_EFFECT.get(rl) : null; + //StatusEffect effect = rl != null ? Registries.STATUS_EFFECT.get(rl) : null; + Optional> opt = Registries.STATUS_EFFECT.getEntry(rl); - if (effect != null) + if (opt.isPresent()) { - set.add(effect); + set.add(opt.get().value()); } else { diff --git a/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java b/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java index 3b9d1b8..d868a70 100644 --- a/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java +++ b/src/main/java/fi/dy/masa/tweakeroo/util/RayTraceUtils.java @@ -3,8 +3,8 @@ import java.util.List; import java.util.Optional; import javax.annotation.Nonnull; -import javax.annotation.Nullable; import com.llamalad7.mixinextras.lib.apache.commons.tuple.Pair; +import org.jetbrains.annotations.Nullable; import net.minecraft.block.Block; import net.minecraft.block.BlockEntityProvider; @@ -32,10 +32,8 @@ import net.minecraft.world.World; import fi.dy.masa.malilib.render.InventoryOverlay; -import fi.dy.masa.malilib.util.Constants; -import fi.dy.masa.malilib.util.EntityUtils; -import fi.dy.masa.malilib.util.NbtKeys; -import fi.dy.masa.malilib.util.WorldUtils; +import fi.dy.masa.malilib.util.InventoryUtils; +import fi.dy.masa.malilib.util.*; import fi.dy.masa.tweakeroo.data.ServerDataSyncer; import fi.dy.masa.tweakeroo.mixin.IMixinAbstractHorseEntity; import fi.dy.masa.tweakeroo.mixin.IMixinPiglinEntity; @@ -275,15 +273,15 @@ else if (entity instanceof PiglinEntity) //inv.size() == 1 && nbt.contains(NbtKeys.ITEMS) && nbt.getList(NbtKeys.ITEMS, Constants.NBT.TAG_COMPOUND).size() > 1) - //!DataManager.getInstance().hasIntegratedServer()) + //!DataManager.getInstance().hasIntegratedServer()) { if (entity instanceof AbstractHorseEntity) { - inv2 = fi.dy.masa.malilib.util.InventoryUtils.getNbtInventoryHorseFix(nbt, -1, entity.getRegistryManager()); + inv2 = InventoryUtils.getNbtInventoryHorseFix(nbt, -1, entity.getRegistryManager()); } else { - inv2 = fi.dy.masa.malilib.util.InventoryUtils.getNbtInventory(nbt, -1, entity.getRegistryManager()); + inv2 = InventoryUtils.getNbtInventory(nbt, -1, entity.getRegistryManager()); } inv = null; } @@ -291,23 +289,23 @@ else if (entity instanceof PiglinEntity) else if (inv != null && //inv.size() == 1 && nbt.contains(NbtKeys.SADDLE)) - //!DataManager.getInstance().hasIntegratedServer()) + //!DataManager.getInstance().hasIntegratedServer()) { - inv2 = fi.dy.masa.malilib.util.InventoryUtils.getNbtInventoryHorseFix(nbt, -1, entity.getRegistryManager()); + inv2 = InventoryUtils.getNbtInventoryHorseFix(nbt, -1, entity.getRegistryManager()); inv = null; } // Fix for empty Villager/Piglin inv else if (inv != null && inv.size() == 8 && nbt.contains(NbtKeys.INVENTORY) && !nbt.getList(NbtKeys.INVENTORY, Constants.NBT.TAG_COMPOUND).isEmpty()) - //!DataManager.getInstance().hasIntegratedServer()) + //!DataManager.getInstance().hasIntegratedServer()) { - inv2 = fi.dy.masa.malilib.util.InventoryUtils.getNbtInventory(nbt, 8, entity.getRegistryManager()); + inv2 = InventoryUtils.getNbtInventory(nbt, 8, entity.getRegistryManager()); inv = null; } else { - inv2 = fi.dy.masa.malilib.util.InventoryUtils.getNbtInventory(nbt, inv != null ? inv.size() : -1, entity.getRegistryManager()); + inv2 = InventoryUtils.getNbtInventory(nbt, inv != null ? inv.size() : -1, entity.getRegistryManager()); if (inv2 != null) { diff --git a/src/main/resources/tweakerge.mixins.json b/src/main/resources/tweakerge.mixins.json index cb77d0a..6a669b3 100644 --- a/src/main/resources/tweakerge.mixins.json +++ b/src/main/resources/tweakerge.mixins.json @@ -16,7 +16,6 @@ "IMixinShovelItem", "IMixinSimpleOption", "MixinAbstractClientPlayerEntity", - "MixinAbstractInventoryScreen", "MixinAbstractSignEditScreen", "MixinBackgroundRenderer", "MixinBatEntity", @@ -44,7 +43,7 @@ "MixinDimensionEffects_Nether", "MixinEntity", "MixinEntityRenderDispatcher", - "MixinExplosion", + "MixinExplosionEmitterParticle", "MixinFillCommand", "MixinGameRenderer", "MixinGameRenderer_ViewBob", @@ -74,10 +73,12 @@ "MixinShulkerBoxBlock", "MixinSignBlockEntity", "MixinSlimeBlock", + "MixinStatusEffectsDisplay", "MixinStructureBlockBlockEntity", "MixinTeleportSpectatorMenu", "MixinTradeOffer", "MixinUpdateStructureBlockC2SPacket", + "MixinWeatherRendering", "MixinWindow", "MixinWorld", "MixinWorldRenderer"