Skip to content

Commit

Permalink
sync with sakura-ryoko/tweakeroo
Browse files Browse the repository at this point in the history
  • Loading branch information
TexBlock committed Jul 10, 2024
1 parent 3cd0e78 commit 55bd4dc
Show file tree
Hide file tree
Showing 40 changed files with 1,524 additions and 245 deletions.
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ org.gradle.jvmargs=-Xmx1G
loom.platform=neoforge

# Base properties
minecraft_version=1.20.6
neoforge_version=20.6.119
yarn_mappings=1.20.6+build.3
yarn_patch=1.20.6+build.4
minecraft_version=1.21
neoforge_version=21.0.78-beta
yarn_mappings=1.21+build.2
yarn_patch=1.21+build.4

# Mod Properties
mod_version=0.1.3
Expand All @@ -19,5 +19,5 @@ loom.platform=neoforge
curseforge_id=915857

# Dependencies
malilib_version=0.1.12-mc1.20.6
neonetwork_version=0.1.5+mc1.20.6
malilib_version=0.1.14-mc1.21
neonetwork_version=0.1.5+mc1.21
10 changes: 10 additions & 0 deletions src/main/java/fi/dy/masa/tweakeroo/Tweakeroo.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ public static void onInitialize()
{
InitializationHandler.getInstance().registerInitializationHandler(new InitHandler());
}

/*
public static void debugLog(String msg, Object... args)
{
if (Configs.Generic.DEBUG_LOGGING.getBooleanValue())
{
Tweakeroo.logger.info(msg, args);
}
}
*/
}
2 changes: 1 addition & 1 deletion src/main/java/fi/dy/masa/tweakeroo/config/Callbacks.java
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public static void init(MinecraftClient mc)
Hotkeys.SIT_DOWN_NEARBY_PETS.getKeybind().setCallback((a, k) -> MiscUtils.commandNearbyPets(true));
Hotkeys.STAND_UP_NEARBY_PETS.getKeybind().setCallback((a, k) -> MiscUtils.commandNearbyPets(false));
Hotkeys.SWAP_ELYTRA_CHESTPLATE.getKeybind().setCallback(callbackGeneric);
Hotkeys.TOGGLE_CARPET_AP_PROTOCOL.getKeybind().setCallback(new KeyCallbackToggleBooleanConfigWithMessage(Configs.Generic.CARPET_ACCURATE_PLACEMENT_PROTOCOL));
Hotkeys.TOGGLE_AP_PROTOCOL.getKeybind().setCallback(new KeyCallbackToggleBooleanConfigWithMessage(Configs.Generic.ACCURATE_PLACEMENT_PROTOCOL));
Hotkeys.TOGGLE_GRAB_CURSOR.getKeybind().setCallback(callbackGeneric);
Hotkeys.TOOL_PICK.getKeybind().setCallback(callbackGeneric);
Hotkeys.WRITE_MAPS_AS_IMAGES.getKeybind().setCallback((a, k) -> MiscUtils.writeAllMapsAsImages());
Expand Down
13 changes: 10 additions & 3 deletions src/main/java/fi/dy/masa/tweakeroo/config/Configs.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import fi.dy.masa.tweakeroo.Reference;
import fi.dy.masa.tweakeroo.tweaks.MiscTweaks;
import fi.dy.masa.tweakeroo.tweaks.PlacementTweaks;
import fi.dy.masa.tweakeroo.util.EasyPlacementProtocol;
import fi.dy.masa.tweakeroo.util.InventoryUtils;
import fi.dy.masa.tweakeroo.util.PlacementRestrictionMode;
import fi.dy.masa.tweakeroo.util.SnapAimMode;
Expand All @@ -36,6 +37,8 @@ public class Configs implements IConfigHandler

public static class Generic
{
public static final ConfigOptionList ACCURATE_PLACEMENT_PROTOCOL_MODE = new ConfigOptionList ("accuratePlacementProtocolMode", EasyPlacementProtocol.AUTO, "The type of \"accurate placement protocol\" to use.\n- Auto: Uses v3 in single player, and by default Slabs-only in multiplayer,\n unless the server has Carpet mod that sends a 'carpet:hello'\n packet, in which case v2 is used on that server.\n- Version 3: Supported by Tweakeroo itself (in single player) or with Servux.\n- Version 2: Compatible with servers with the Carpet mod\n (either QuickCarpet by skyrising and DeadlyMC,\n or CarpetExtra in addition to FabricCarpet.\n And in both cases the 'accurateBlockPlacement' Carpet rule needs\n to be enabled on the server).\n- Slabs only: Only fixes top slabs. Compatible with Paper servers.\n- None: Does not modify coordinates.");
public static final ConfigBoolean ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("accuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)");
public static final ConfigInteger AFTER_CLICKER_CLICK_COUNT = new ConfigInteger ("afterClickerClickCount", 1, 1, 32, "The number of right clicks to do per placed block when\ntweakAfterClicker is enabled");
public static final ConfigDouble ANGEL_BLOCK_PLACEMENT_DISTANCE = new ConfigDouble ("angelBlockPlacementDistance", 3, 1, 5, "The distance from the player blocks can be placed in\nthe air when tweakAngelBlock is enabled.\n5 is the maximum the server allows.");
public static final ConfigDouble BLOCK_REACH_DISTANCE = new ConfigDouble ("blockReachDistance", 4.5, 1, 64, "The block reach distance to use if the override tweak is enabled.\nThe maximum the game allows is 64.\n§6Do not attempt to use this at a value beyond\n[0.5 - 1.0] higher than the Game Rules defined on a server.");
Expand All @@ -44,7 +47,6 @@ public static class Generic
public static final ConfigOptionList BREAKING_RESTRICTION_MODE = new ConfigOptionList ("breakingRestrictionMode", PlacementRestrictionMode.LINE, "The Breaking Restriction mode to use (hotkey-selectable)");
public static final ConfigColor CHAT_BACKGROUND_COLOR = new ConfigColor ("chatBackgroundColor", "#80000000", "The background color for the chat messages,\nif 'tweakChatBackgroundColor' is enabled");
public static final ConfigString CHAT_TIME_FORMAT = new ConfigString ("chatTimeFormat", "[HH:mm:ss]", "The time format for chat messages, if tweakChatTimestamp is enabled\nUses the Java SimpleDateFormat format specifiers.");
public static final ConfigBoolean CARPET_ACCURATE_PLACEMENT_PROTOCOL = new ConfigBoolean ("carpetAccuratePlacementProtocol", true, "If enabled, then the Flexible Block Placement and the\nAccurate Block Placement use the protocol implemented in Carpet mod.\n§6Note: This is required for any block rotations to work, other than\n§6blocks that only care about the block side you click on (Hoppers, Logs etc.)");
public static final ConfigBoolean CLIENT_PLACEMENT_ROTATION = new ConfigBoolean ("clientPlacementRotation", true, "Enable single player and client side placement rotations,\nsuch as Accurate Placement working in single player without Carpet mod");
public static final ConfigInteger CUSTOM_INVENTORY_GUI_SCALE = new ConfigInteger ("customInventoryGuiScale", 2, 1, 10, "The GUI scale value to use for inventory screens, if\n§etweakCustomInventoryScreenScale§r is enabled.");
//public static final ConfigBoolean DEBUG_LOGGING = new ConfigBoolean ("debugLogging", false, "Enables some debug log messages in the game console,\nfor debugging certain issues or crashes.");
Expand Down Expand Up @@ -111,11 +113,14 @@ public static class Generic
public static final ConfigInteger STRUCTURE_BLOCK_MAX_SIZE = new ConfigInteger ("structureBlockMaxSize", 128, 1, 256, "The maximum dimensions for a Structure Block's saved area");
public static final ConfigString TOOL_SWITCHABLE_SLOTS = new ConfigString ("toolSwitchableSlots", "1-9", "The slots that the Tool Switch tweak is allowed to put tools to.\nNote that Tool Switch can also switch to other slots in the hotbar,\nif they already have the preferred tool, but it will only\nswap new tools to these slots");
public static final ConfigString TOOL_SWITCH_IGNORED_SLOTS = new ConfigString ("toolSwitchIgnoredSlots", "", "The slots where the Tool Switch tweak does not work when they are active.");
public static final ConfigBoolean TOOL_SWAP_BETTER_ENCHANTS = new ConfigBoolean ("toolSwapBetterEnchants", false, "Consider a Tools' Enchantments and Rarity\nfor Tool swapping, only after comparing if\nit's the correct tool to use on the target.");
public static final ConfigBoolean WEAPON_SWAP_BETTER_ENCHANTS = new ConfigBoolean ("weaponSwapBetterEnchants", false, "Consider a Weapons' Enchantments and Rarity\nfor Weapon swapping, only after comparing if \nit's the correct Weapon to use on the target.");
public static final ConfigBoolean ZOOM_ADJUST_MOUSE_SENSITIVITY = new ConfigBoolean ("zoomAdjustMouseSensitivity", true, "If enabled, then the mouse sensitivity is reduced\nwhile the zoom feature is enabled and the zoom key is active");
public static final ConfigDouble ZOOM_FOV = new ConfigDouble ("zoomFov", 30, 0.01, 359.99, "The FOV value used for the zoom feature");

public static final ImmutableList<IConfigBase> OPTIONS = ImmutableList.of(
CARPET_ACCURATE_PLACEMENT_PROTOCOL,
ACCURATE_PLACEMENT_PROTOCOL_MODE,
ACCURATE_PLACEMENT_PROTOCOL,
CLIENT_PLACEMENT_ROTATION,
//DEBUG_LOGGING,
FAST_LEFT_CLICK_ALLOW_TOOLS,
Expand Down Expand Up @@ -194,6 +199,8 @@ public static class Generic
STRUCTURE_BLOCK_MAX_SIZE,
TOOL_SWITCHABLE_SLOTS,
TOOL_SWITCH_IGNORED_SLOTS,
TOOL_SWAP_BETTER_ENCHANTS,
WEAPON_SWAP_BETTER_ENCHANTS,
ZOOM_FOV
);
}
Expand All @@ -220,7 +227,7 @@ public static class Lists
public static final ConfigOptionList ENTITY_TYPE_ATTACK_RESTRICTION_LIST_TYPE = new ConfigOptionList("entityTypeAttackRestrictionListType", ListType.BLACKLIST, "The restriction list type for the Entity Type Attack Restriction tweak");
public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_BLACKLIST = new ConfigStringList("entityTypeAttackRestrictionBlackList", ImmutableList.of("minecraft:villager"), "The entities that are NOT allowed to be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to Black List");
public static final ConfigStringList ENTITY_TYPE_ATTACK_RESTRICTION_WHITELIST = new ConfigStringList("entityTypeAttackRestrictionWhiteList", ImmutableList.of(), "The only entities that can be attacked while the Entity Attack Restriction tweak is enabled,\nif the entityAttackRestrictionListType is set to White List");
public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of("<default> => minecraft:diamond_sword, minecraft:golden_sword, minecraft:iron_sword, minecraft:netherite_sword, minecraft:stone_sword, minecraft:wooden_sword", "minecraft:end_crystal, minecraft:item_frame, minecraft:glow_item_frame, minecraft:leash_knot => <ignore>", "minecraft:minecart, minecraft:chest_minecart, minecraft:furnace_minecart, minecraft:hopper_minecart, minecraft:hopper_minecart, minecraft:spawner_minecart, minecraft:tnt_minecart, minecraft:boat=> minecraft:diamond_axe, minecraft:golden_axe, minecraft:iron_axe, minecraft:netherite_axe, minecraft:stone_axe, minecraft:wooden_axe"), "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'<default>' will be used when no other mapping is defined.\n'<ignore>' will not trigger a weapon switch.");
public static final ConfigStringList ENTITY_WEAPON_MAPPING = new ConfigStringList("entityWeaponMapping", ImmutableList.of("<default> => 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 => <ignore>", "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"), "Mapping for what weapon should be used with the\n'tweakWeaponSwitch' tweak.\n'<default>' will be used when no other mapping is defined.\n'<ignore>' will not trigger a weapon switch.");
public static final ConfigOptionList FAST_PLACEMENT_ITEM_LIST_TYPE = new ConfigOptionList("fastPlacementItemListType", ListType.BLACKLIST, "The item restriction type for the Fast Block Placement tweak");
public static final ConfigStringList FAST_PLACEMENT_ITEM_BLACKLIST = new ConfigStringList("fastPlacementItemBlackList", ImmutableList.of("minecraft:ender_chest", "minecraft:white_shulker_box"), "The items that are NOT allowed to be used for the Fast Block Placement tweak,\nif the fastPlacementItemListType is set to Black List");
public static final ConfigStringList FAST_PLACEMENT_ITEM_WHITELIST = new ConfigStringList("fastPlacementItemWhiteList", ImmutableList.of(), "The items that are allowed to be used for the Fast Block Placement tweak,\nif the fastPLacementItemListType is set to White List");
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/fi/dy/masa/tweakeroo/config/FeatureToggle.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable<IConfig
TWEAK_ACCURATE_BLOCK_PLACEMENT ("tweakAccurateBlockPlacement", false, "", "Enables a simpler version of Flexible placement, similar to\nthe Carpet mod, so basically either facing into or out\nfrom the block face clicked on."),
TWEAK_AFTER_CLICKER ("tweakAfterClicker", false, "", KeybindSettings.INGAME_BOTH, "Enables a \"after clicker\" tweak, which does automatic right\nclicks on the just-placed block.\nUseful for example for Repeaters (setting the delay).\nTo quickly adjust the value, scroll while\nholding down the tweak toggle keybind."),
TWEAK_AIM_LOCK ("tweakAimLock", false, "", "Enables an aim lock, locking the yaw and pitch rotations\nto the current values.\nThis is separate from the snap aim lock,\nwhich locks them to the snapped value.\nThis allows locking them \"freely\" to the current value."),
TWEAK_ANGEL_BLOCK ("tweakAngelBlock", false, "", "Enables an \"Angel Block\" tweak, which allows\nplacing blocks in mid-air in Creative mode"),
TWEAK_ANGEL_BLOCK ("tweakAngelBlock", false, "", "Enables an \"Angel Block\" tweak, which allows\nplacing blocks in mid-air in Creative mode.\nPowered by \"Flotato\" technology."),
TWEAK_AUTO_SWITCH_ELYTRA ("tweakAutoSwitchElytra", false, "", "Automatically switches to the Elytra when falling\nand back to the previous chest equipment when landing."),
TWEAK_BLOCK_REACH_OVERRIDE ("tweakBlockReachOverride", false, true, "", "Overrides the block reach distance with\nthe one set in Generic -> blockReachDistance"),
TWEAK_BLOCK_TYPE_BREAK_RESTRICTION("tweakBlockTypeBreakRestriction", false, "", "Restricts which blocks you are able to break (manually).\nSee the corresponding 'blockBreakRestriction*' configs in the Lists category."),
TWEAK_BREAKING_GRID ("tweakBreakingGrid", false, "", KeybindSettings.INGAME_BOTH, "When enabled, you can only break blocks in\na grid pattern, with a configurable interval.\nTo quickly adjust the interval, scroll while\nholding down the tweak toggle keybind."),
Expand Down Expand Up @@ -66,6 +67,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable<IConfig
TWEAK_LAVA_VISIBILITY ("tweakLavaVisibility", false, "", "If enabled, then the level of Respiration and Aqua Affinity enchantments,\nand having the Fire Resistance effect active,\nwill greatly increase the visibility under lava."),
TWEAK_MAP_PREVIEW ("tweakMapPreview", false, "", "If enabled, then holding shift over maps in an inventory\nwill render a preview of the map"),
TWEAK_MOVEMENT_KEYS ("tweakMovementKeysLast", false, "", "If enabled, then opposite movement keys won't cancel each other,\nbut instead the last pressed key is the active input."),
TWEAK_NO_BLOCK_BREAK_CD ("tweakNoBlockBreakCooldown", false, "", "Disables the block breaking cooldown,\nfor the time taken in between breaking\nblocks"),
TWEAK_PERIODIC_ATTACK ("tweakPeriodicAttack", false, "", "Enables periodic attacks (left clicks)\nConfigure the interval in Generic -> periodicAttackInterval"),
TWEAK_PERIODIC_USE ("tweakPeriodicUse", false, "", "Enables periodic uses (right clicks)\nConfigure the interval in Generic -> periodicUseInterval"),
TWEAK_PERIODIC_HOLD_ATTACK ("tweakPeriodicHoldAttack", false, "", "Enables periodically holding attack for a configurable amount of time.\nConfigure the interval in Generic -> periodicHoldAttackInterval\nand the duration in periodicHoldAttackDuration\n§6Note: You should not use the normal hold attack\n§6or the periodic attack at the same time"),
Expand All @@ -87,6 +89,7 @@ public enum FeatureToggle implements IHotkeyTogglable, IConfigNotifiable<IConfig
TWEAK_RENDER_LIMIT_ENTITIES ("tweakRenderLimitEntities", false, "", "Enables limiting the number of certain types of entities\nto render per frame. Currently XP Orbs and Item entities\nare supported, see Generic configs for the limits."),
TWEAK_REPAIR_MODE ("tweakRepairMode", false, "", "If enabled, then fully repaired items held in hand will\nbe swapped to damaged items that have Mending on them."),
TWEAK_SCULK_PULSE_LENGTH ("tweakSculkPulseLength", false, true, "", "Allows modifying the Sculk Sensor pulse length. Set the pulse length in Generic -> sculkSensorPulseLength"),
TWEAK_SERVER_DATA_SYNC ("tweakServerDataSync", false, "", "Use Server Data Syncer for entities such as Shulker Boxes,\nwhich allows inventoryPreview to work on servers.\n§6You must be an operator of the server or install server-side\n§6mods to make the syncer work even this option is set to true."),
TWEAK_SHULKERBOX_DISPLAY ("tweakShulkerBoxDisplay", false, "", "Enables the Shulker Box contents display when hovering\nover them in an inventory and holding shift"),
TWEAK_SIGN_COPY ("tweakSignCopy", false, "", "When enabled, placed signs will use the text from\nthe previously placed sign.\nCan be combined with tweakNoSignGui to quickly place copies\nof a sign, by enabling that tweak after making the first sign."),
TWEAK_SNAP_AIM ("tweakSnapAim", false, "", KeybindSettings.INGAME_BOTH, "Enabled a snap aim tweak, to make the player face to pre-set exact yaw rotations"),
Expand Down
Loading

0 comments on commit 55bd4dc

Please sign in to comment.