repo_name stringlengths 1 62 | dataset stringclasses 1 value | lang stringclasses 11 values | pr_id int64 1 20.1k | owner stringlengths 2 34 | reviewer stringlengths 2 39 | diff_hunk stringlengths 15 262k | code_review_comment stringlengths 1 99.6k |
|---|---|---|---|---|---|---|---|
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -11,47 +11,50 @@ This makes the strategy specific contract as simple and specific to that yield g
- Shares: ERC20-compliant token that tracks Asset balance in the strategy for every distributor.
- Strategy: ERC4626 compliant smart contract that receives Assets from Depositors (vault or otherwise) to deposit in any external protocol to generate yield.
- Tokenized Strategy: The implementation contract that all strategies delegateCall to for the standard ERC4626 and profit locking functions.
-- BaseTokenizedStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
+- BaseStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
- Strategist: The developer of a specific strategy.
- Depositor: Account that holds Shares
- Vault: Or "Meta Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution. | "allocator vault" |
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -11,47 +11,50 @@ This makes the strategy specific contract as simple and specific to that yield g
- Shares: ERC20-compliant token that tracks Asset balance in the strategy for every distributor.
- Strategy: ERC4626 compliant smart contract that receives Assets from Depositors (vault or otherwise) to deposit in any external protocol to generate yield.
- Tokenized Strategy: The implementation contract that all strategies delegateCall to for the standard ERC4626 and profit locking functions.
-- BaseTokenizedStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
+- BaseStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
- Strategist: The developer of a specific strategy.
- Depositor: Account that holds Shares
- Vault: Or "Meta Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution.
- Management: The owner of the specific strategy that can set fees, profit unlocking time etc.
+- Emergency Admin: A address specified by management to be able to call certain emergency functions.
- Keeper: the address of a contract allowed to call report() and tend() on a strategy.
-- Factory: The factory that all meta vaults of a specific API version are cloned from that also controls the protocol fee amount and recipient.
+- Factory: The factory that all meta vaults of a specific API version are deployed from that also controls the protocol fee amount and recipient. | "allocator vault" |
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -11,47 +11,50 @@ This makes the strategy specific contract as simple and specific to that yield g
- Shares: ERC20-compliant token that tracks Asset balance in the strategy for every distributor.
- Strategy: ERC4626 compliant smart contract that receives Assets from Depositors (vault or otherwise) to deposit in any external protocol to generate yield.
- Tokenized Strategy: The implementation contract that all strategies delegateCall to for the standard ERC4626 and profit locking functions.
-- BaseTokenizedStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
+- BaseStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
- Strategist: The developer of a specific strategy.
- Depositor: Account that holds Shares
- Vault: Or "Meta Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution.
- Management: The owner of the specific strategy that can set fees, profit unlocking time etc.
+- Emergency Admin: A address specified by management to be able to call certain emergency functions.
- Keeper: the address of a contract allowed to call report() and tend() on a strategy.
-- Factory: The factory that all meta vaults of a specific API version are cloned from that also controls the protocol fee amount and recipient.
+- Factory: The factory that all meta vaults of a specific API version are deployed from that also controls the protocol fee amount and recipient.
## Storage
In order to standardize all high risk and complex logic associated with ERC4626, ERC20 and profit locking, all core logic has been moved to the 'TokenizedStrategy.sol' and is used by each strategy through a fallback function that delegatecall's this contract to do all necessary checks, logic and storage updates for the strategy. | no `'` needed in "delagatecalls" |
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -11,47 +11,50 @@ This makes the strategy specific contract as simple and specific to that yield g
- Shares: ERC20-compliant token that tracks Asset balance in the strategy for every distributor.
- Strategy: ERC4626 compliant smart contract that receives Assets from Depositors (vault or otherwise) to deposit in any external protocol to generate yield.
- Tokenized Strategy: The implementation contract that all strategies delegateCall to for the standard ERC4626 and profit locking functions.
-- BaseTokenizedStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
+- BaseStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
- Strategist: The developer of a specific strategy.
- Depositor: Account that holds Shares
- Vault: Or "Meta Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution.
- Management: The owner of the specific strategy that can set fees, profit unlocking time etc.
+- Emergency Admin: A address specified by management to be able to call certain emergency functions.
- Keeper: the address of a contract allowed to call report() and tend() on a strategy.
-- Factory: The factory that all meta vaults of a specific API version are cloned from that also controls the protocol fee amount and recipient.
+- Factory: The factory that all meta vaults of a specific API version are deployed from that also controls the protocol fee amount and recipient.
## Storage
In order to standardize all high risk and complex logic associated with ERC4626, ERC20 and profit locking, all core logic has been moved to the 'TokenizedStrategy.sol' and is used by each strategy through a fallback function that delegatecall's this contract to do all necessary checks, logic and storage updates for the strategy.
-The TokenizedStrategy will only need to be deployed once on each chain and can then be used by an unlimited number of strategies. Allowing the BaseTokenizedStrategy.sol to be much smaller, simpler and cheaper to deploy.
+The TokenizedStrategy will only need to be deployed once on each chain and can then be used by an unlimited number of strategies. Allowing the BaseStrategy.sol to be much smaller, simpler and cheaper to deploy.
-Using delegate call the external TokenizedStrategyy will be able read and write to any and all of the strategies specific storage variables during all calls. This does open the strategy up to the possibility of storage collisions due to non-standardized storage calls and means extra precautions need to be taken when reading and writing to storage.
+Using delegate call the external TokenizedStrategy will be able read and write to any and all of the strategies specific storage variables during all calls. This does open the strategy up to the possibility of storage collisions due to non-standardized storage calls and means extra precautions need to be taken when reading and writing to storage. | "strategy-specific" rather than "strategies specific" |
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -11,47 +11,50 @@ This makes the strategy specific contract as simple and specific to that yield g
- Shares: ERC20-compliant token that tracks Asset balance in the strategy for every distributor.
- Strategy: ERC4626 compliant smart contract that receives Assets from Depositors (vault or otherwise) to deposit in any external protocol to generate yield.
- Tokenized Strategy: The implementation contract that all strategies delegateCall to for the standard ERC4626 and profit locking functions.
-- BaseTokenizedStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
+- BaseStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
- Strategist: The developer of a specific strategy.
- Depositor: Account that holds Shares
- Vault: Or "Meta Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution.
- Management: The owner of the specific strategy that can set fees, profit unlocking time etc.
+- Emergency Admin: A address specified by management to be able to call certain emergency functions.
- Keeper: the address of a contract allowed to call report() and tend() on a strategy.
-- Factory: The factory that all meta vaults of a specific API version are cloned from that also controls the protocol fee amount and recipient.
+- Factory: The factory that all meta vaults of a specific API version are deployed from that also controls the protocol fee amount and recipient.
## Storage
In order to standardize all high risk and complex logic associated with ERC4626, ERC20 and profit locking, all core logic has been moved to the 'TokenizedStrategy.sol' and is used by each strategy through a fallback function that delegatecall's this contract to do all necessary checks, logic and storage updates for the strategy.
-The TokenizedStrategy will only need to be deployed once on each chain and can then be used by an unlimited number of strategies. Allowing the BaseTokenizedStrategy.sol to be much smaller, simpler and cheaper to deploy.
+The TokenizedStrategy will only need to be deployed once on each chain and can then be used by an unlimited number of strategies. Allowing the BaseStrategy.sol to be much smaller, simpler and cheaper to deploy.
-Using delegate call the external TokenizedStrategyy will be able read and write to any and all of the strategies specific storage variables during all calls. This does open the strategy up to the possibility of storage collisions due to non-standardized storage calls and means extra precautions need to be taken when reading and writing to storage.
+Using delegate call the external TokenizedStrategy will be able read and write to any and all of the strategies specific storage variables during all calls. This does open the strategy up to the possibility of storage collisions due to non-standardized storage calls and means extra precautions need to be taken when reading and writing to storage.
In order to limit the strategists need to think about their storage variables all TokenizedStrategy specific variables are held within and controlled by the TokenizedStrategy. A `StrategyData` struct is held at a custom storage location that is high enough that no normal implementation should be worried about hitting.
This means all high risk storage updates will always be handled by the TokenizedStrategy, should not be able to be overridden by a reckless strategist and will be entirely standardized across every strategy deployed, no matter the chain or specific implementation.
-## BaseTokenizedStrategy
+## BaseStrategy
-The base tokenized strategy is a simple abstract contract to be inherited by the strategist that handles all communication with the TokenizedStrategy.
+The base strategy is a simple abstract contract to be inherited by the strategist that handles all communication with the TokenizedStrategy. | "The base strategy is a simple abstract contract designed to be inherited by the strategist. Doing this will automatically handle all communication with the TokenizedStrategy, saving a lot of effort." |
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -137,7 +137,7 @@ abstract contract BaseStrategy {
// Set instance of the implementation for internal use.
TokenizedStrategy = ITokenizedStrategy(address(this));
- // Initilize the strategies storage variables.
+ // Initialize the strategies storage variables. | "strategy's" |
tokenized-strategy | github_2023 | others | 69 | yearn | wavey0x | @@ -7,33 +7,33 @@ This makes the strategy specific contract as simple and specific to that yield g
### Definitions
-- Asset: Any ERC20-compliant token
+- Asset: Any ERC20-compliant token.
- Shares: ERC20-compliant token that tracks Asset balance in the strategy for every distributor.
- Strategy: ERC4626 compliant smart contract that receives Assets from Depositors (vault or otherwise) to deposit in any external protocol to generate yield.
- Tokenized Strategy: The implementation contract that all strategies delegateCall to for the standard ERC4626 and profit locking functions.
- BaseStrategy: The abstract contract that a strategy should inherit from that handles all communication with the Tokenized Strategy contract.
- Strategist: The developer of a specific strategy.
-- Depositor: Account that holds Shares
-- Vault: Or "Meta Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution.
+- Depositor: Account that holds Shares.
+- Vault: Or "Allocator Vault" is an ERC4626 compliant Smart contract that receives Assets from Depositors to then distribute them among the different Strategies added to the vault, managing accounting and Assets distribution. | "strategies" lowercase |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -115,7 +117,8 @@ abstract contract BaseTokenizedStrategy {
ITokenizedStrategy internal immutable TokenizedStrategy;
// Underlying asset the Strategy is earning yield on.
- address public immutable asset;
+ // Stored here for cheap retrievals wihtin the strategy.
+ ERC20 internal immutable asset; | Curious why we decided to switch to ERC20 here. Do we always cast to ERC20? |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -246,16 +254,30 @@ abstract contract BaseTokenizedStrategy {
function _tend(uint256 _totalIdle) internal virtual {}
/**
- * @notice Returns weather or not tend() should be called by a keeper.
* @dev Optional trigger to override if tend() will be used by the strategy.
* This must be implemented if the strategy hopes to invoke _tend().
*
* @return . Should return true if tend() should be called by keeper or false if not.
*/
- function tendTrigger() external view virtual returns (bool) {
+ function _tendTrigger() internal view virtual returns (bool) {
return false;
}
+ /**
+ * @notice Returns if tend() should be called by a keeper.
+ *
+ * @return . Should return true if tend() should be called by keeper or false if not.
+ * @return . Calldata for the tend call.
+ */
+ function tendTrigger() external view virtual returns (bool, bytes memory) {
+ return (
+ // Return the status of the tend trigger.
+ _tendTrigger(),
+ // And the needed calldata either way.
+ abi.encodeWithSelector(ITokenizedStrategy.tend.selector) | Pardon my ignorance, what's the point of returning the calldata? In case tend might be parameterized? |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -412,36 +434,38 @@ abstract contract BaseTokenizedStrategy {
*
* @param _amount The amount of asset to attempt to free.
*/
- function shutdownWithdraw(uint256 _amount) external onlySelf {
+ function shutdownWithdraw(uint256 _amount) external virtual onlySelf {
_emergencyWithdraw(_amount);
}
/**
- * @dev Funciton used on initialization to delegate call the
- * TokenizedStrategy to setup the default storage for the strategy.
+ * @dev Funciton used to delegate call the TokenizedStrategy with
+ * certain `_calldata` and return any return values.
*
- * We cannot use the `TokenizedStrategy` variable call since this
- * contract is not deployed fully yet. So we need to manually
- * delegateCall the TokenizedStrategy.
+ * This is used to setup the intial storage of the strategy, and
+ * can be used by strategist to forward any other call to the
+ * TokenizedStrategy implementation.
*
- * This is the only time an internal delegateCall should not
- * be for a view function
+ * @param _calldata The abi encoded calldata to use in delegatecall.
+ * @return . The return value if the call was successful in bytes.
*/
- function _init(
- address _asset,
- string memory _name,
- address _management,
- address _performanceFeeRecipient,
- address _keeper
- ) private {
- (bool success, ) = tokenizedStrategyAddress.delegatecall(
- abi.encodeCall(
- ITokenizedStrategy.init,
- (_asset, _name, _management, _performanceFeeRecipient, _keeper)
- )
- );
+ function _delegate(bytes memory _calldata) internal returns (bytes memory) { | I'm not 100% sure i like the name of this function, but I could live with it. |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -707,34 +713,40 @@ contract TokenizedStrategy {
* the effects of their redemption at the current block,
* given current on-chain conditions.
* @dev This will round down.
+ *
+ * @param shares The amount of shares that would be redeemed.
+ * @return . The amoun of `asset` that would be returned.
*/
function previewRedeem(uint256 shares) public view returns (uint256) {
return convertToAssets(shares);
}
/**
* @notice Total number of underlying assets that can
- * be deposited by `_owner` into the strategy, where `_owner`
+ * be deposited by `_owner` into the strategy, where `owner`
* corresponds to the receiver of a {deposit} call.
+ *
+ * @param owner The addres depositing.
+ * @return . The max that `owner` can deposit in `asset`.
*/
- function maxDeposit(address _owner) public view returns (uint256) {
+ function maxDeposit(address owner) public view returns (uint256) {
if (_strategyStorage().shutdown) return 0;
- return
- IBaseTokenizedStrategy(address(this)).availableDepositLimit(_owner);
+ return IBaseStrategy(address(this)).availableDepositLimit(owner);
}
/**
- * @notice Total number of shares that can be minted by `_owner`
+ * @notice Total number of shares that can be minted by `owner`
* into the strategy, where `_owner` corresponds to the receiver
* of a {mint} call.
+ *
+ * @param owner The addres minting. | ```suggestion
* @param owner The address minting.
``` |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -707,34 +713,40 @@ contract TokenizedStrategy {
* the effects of their redemption at the current block,
* given current on-chain conditions.
* @dev This will round down.
+ *
+ * @param shares The amount of shares that would be redeemed.
+ * @return . The amoun of `asset` that would be returned. | ```suggestion
* @return . The amount of `asset` that would be returned.
``` |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -707,34 +713,40 @@ contract TokenizedStrategy {
* the effects of their redemption at the current block,
* given current on-chain conditions.
* @dev This will round down.
+ *
+ * @param shares The amount of shares that would be redeemed.
+ * @return . The amoun of `asset` that would be returned.
*/
function previewRedeem(uint256 shares) public view returns (uint256) {
return convertToAssets(shares);
}
/**
* @notice Total number of underlying assets that can
- * be deposited by `_owner` into the strategy, where `_owner`
+ * be deposited by `_owner` into the strategy, where `owner`
* corresponds to the receiver of a {deposit} call.
+ *
+ * @param owner The addres depositing. | ```suggestion
* @param owner The address depositing.
``` |
tokenized-strategy | github_2023 | others | 67 | yearn | fp-crypto | @@ -765,20 +781,20 @@ contract TokenizedStrategy {
* @notice Total number of strategy shares that can be
* redeemed from the strategy by `owner`, where `owner`
* corresponds to the msg.sender of a {redeem} call.
+ *
+ * @param owner The owener of the shares. | ```suggestion
* @param owner The owner of the shares.
``` |
tokenized-strategy | github_2023 | others | 65 | yearn | fp-crypto | @@ -1144,40 +1144,51 @@ contract TokenizedStrategy {
* A report() call will be needed to record the profit.
*/
function tend() external nonReentrant onlyKeepers {
+ // Tend the strategy with the current totalIdle.
+ IBaseTokenizedStrategy(address(this)).tendThis(
+ _strategyStorage().totalIdle
+ );
+
+ // Update balances based on ending state.
+ _updateBalances();
+ }
+
+ /**
+ * @notice Update the internal balances that make up `totalAssets`.
+ * @dev This will update the ratio of debt and idle that make up
+ * totalAssets based on the actual current loose amount of `asset`
+ * in a safe way. But will keep `totalAssets` the same, thus having
+ * no effect on Price Per Share.
+ */
+ function _updateBalances() internal {
StrategyData storage S = _strategyStorage(); | So a minor tradeoff here is we need to get the storage pointer twice? |
tokenized-strategy | github_2023 | others | 65 | yearn | fp-crypto | @@ -1221,40 +1221,51 @@ contract TokenizedStrategy {
* A report() call will be needed to record the profit.
*/
function tend() external nonReentrant onlyKeepers {
+ // Tend the strategy with the current totalIdle.
+ IBaseTokenizedStrategy(address(this)).tendThis(
+ _strategyStorage().totalIdle
+ );
+
+ // Update balances based on ending state.
+ _updateBalances();
+ }
+
+ /**
+ * @notice Update the internal balances that make up `totalAssets`.
+ * @dev This will update the ratio of debt and idle that make up
+ * totalAssets based on the actual current loose amount of `asset`
+ * in a safe way. But will keep `totalAssets` the same, thus having
+ * no effect on Price Per Share.
+ */
+ function _updateBalances() internal {
StrategyData storage S = _strategyStorage();
- // Expected Behavior is this will get used twice so we cache it
- uint256 _totalIdle = S.totalIdle;
- ERC20 _asset = S.asset;
- uint256 beforeBalance = _asset.balanceOf(address(this));
- IBaseTokenizedStrategy(address(this)).tendThis(_totalIdle);
- uint256 afterBalance = _asset.balanceOf(address(this));
+ // Get the current loose balance.
+ uint256 assetBalance = S.asset.balanceOf(address(this));
- uint256 diff;
- // Adjust storage according to the changes without adjusting totalAssets().
- if (beforeBalance > afterBalance) {
- // Idle funds were deposited.
- unchecked {
- diff = beforeBalance - afterBalance;
- }
- uint256 deposited = Math.min(diff, _totalIdle);
+ // If its already accurate do nothing.
+ if (S.totalIdle == assetBalance) return;
- unchecked {
- S.totalIdle -= deposited;
- S.totalDebt += deposited;
- }
- } else if (afterBalance > beforeBalance) {
- // We default to use any funds freed as idle for cheaper withdraw/redeems.
- unchecked {
- diff = afterBalance - beforeBalance;
- }
- uint256 harvested = Math.min(diff, S.totalDebt);
+ // Get the total assets the strategy should have.
+ uint256 _totalAssets = totalAssets();
+ // If we have enough loose to cover all assets.
+ if (assetBalance >= _totalAssets) {
+ // Set idle to totalAssets.
+ S.totalIdle = _totalAssets; | What does this mean for the delta between `assetBalance` and `totalIdle`? |
tokenized-strategy | github_2023 | others | 64 | yearn | fp-crypto | @@ -812,8 +884,9 @@ contract TokenizedStrategy {
uint256 maxLoss
) private returns (uint256) {
require(receiver != address(0), "ZERO ADDRESS");
- require(shares <= maxRedeem(owner), "ERC4626: withdraw more than max");
+ require(maxLoss <= MAX_BPS, "max loss"); | i'm not sure this is a helpful error message |
tokenized-strategy | github_2023 | others | 64 | yearn | fp-crypto | @@ -812,8 +884,9 @@ contract TokenizedStrategy {
uint256 maxLoss
) private returns (uint256) {
require(receiver != address(0), "ZERO ADDRESS");
- require(shares <= maxRedeem(owner), "ERC4626: withdraw more than max"); | is this check no longer required? |
tokenized-strategy | github_2023 | others | 10 | yearn | Schlagonia | @@ -46,44 +46,44 @@ abstract contract BaseStrategy is IBaseStrategy {
// Keep this private with a getter function so it can be easily accessed by strategists but not updated
uint8 private _decimals;
- constructor(address _asset, string memory _name, string memory _symbol) {
- _initialize(_asset, _name, _symbol, msg.sender);
+ constructor(address _asset, string memory _name) {
+ _initialize(_asset, _name, msg.sender);
}
function initialize(
address _asset,
string memory _name,
- string memory _symbol,
address _management
) external {
- _initialize(_asset, _name, _symbol, _management);
+ _initialize(_asset, _name, _management);
}
// TODO: ADD additional variables for keeper performance fee etc?
function _initialize(
address _asset,
string memory _name,
- string memory _symbol,
address _management
) internal {
// make sure we have not been initialized
require(asset == address(0), "!init");
// set ERC20 variables
asset = _asset;
- _decimals = IERC20Metadata(_asset).decimals();
+ IERC20Metadata a = IERC20Metadata(_asset);
+ _decimals = a.decimals();
// initilize the strategies storage variables
+ string memory _symbol = string(abi.encodePacked("ys", a.symbol(), "-", _name)); | We probably want the symbol to be smaller than the name right. So just addingthe name on at the end will always make it longer.
Wondering if there is a shorter way to differentiate each strategy? |
zero | github_2023 | others | 28 | raystubbs | raystubbs | @@ -0,0 +1,53 @@
+(ns zero-to-one.client-test
+ (:require [cljs.test :refer [deftest async is use-fixtures]]
+ [zero-to-one.client :as client]
+ [zero.component]))
+
+(defn- make-incrementing-button
+ []
+ (.createElement js/document "incrementing-button"))
+
+(defn- get-incrementing-button
+ []
+ (.querySelector js/document "incrementing-button"))
+
+(defn- attach-to-dom!
+ [el on-complete]
+ (js/document.body.append el)
+ (js/Promise.
+ (fn [resolve reject]
+ (.addEventListener (.-shadowRoot el) "render"
+ (fn []
+ (try
+ (on-complete)
+ (resolve el)
+ (catch :default ex
+ (reject ex)))
+ #js {:once true})))))
+
+(use-fixtures :each
+ {:before #(async done
+ (-> (make-incrementing-button)
+ (attach-to-dom! done)))
+ :after #(async done
+ (.remove (get-incrementing-button))
+ (reset! client/clicks* 0)
+ (done))})
+
+(deftest incrementing-button-is-registered
+ (is (js/customElements.get "incrementing-button")))
+
+(deftest incrementing-button-test
+ (async done | Neat, didn't know about this 😅 |
zero | github_2023 | others | 19 | raystubbs | raystubbs | @@ -29,6 +29,111 @@ A toolkit for building web components in Clojure and ClojureScript.
- Web components are cool, but the native API for building them isn't very convenient
- Zero makes web components easy
+## Reactive State
+Zero gives you tools for reactive state. You can choose to stick close to the DOM, following HATEOS principles. You can use a central in-memory application database similar to re-frame. Or you can choose from intermediate options -- how you manage state is up to you.
+
+Let's show the different options using the same example: an incrementing button. We want a button that reads "Clicked 0 Times". Every time you click it, it should increment the counter.
+
+You can render this button wherever you choose: in React, Svelte, pure HTML. It looks like this:
+
+```html
+<increment-button clicks="0"></increment-button>
+```
+
+This can be implemented a few different ways. We will consider several examples, moving from the low level to the high level.
+
+### Manual Event Handling
+Zero makes custom component reactive. Similar to React's notion that a view is a function of its props, we can render a web component as a function of its properties.
+
+
+```clojurescript
+(ns increment-counter
+ (:require [zero.core :as z]
+ [zero.config :as zc]
+ [zero.component]))
+
+(defn on-click
+ [event]
+ (let [increment-button (.-host (.-currentTarget event))
+ clicks (js/parseInt (.-clicks increment-button))]
+ (set! (.-clicks increment-button) (inc clicks))))
+
+(defn button-view
+ [{:keys [clicks]}]
+ [:root> {::z/on {:click on-click}}
+ [:button (str "Clicked " clicks " times")]])
+
+(zc/reg-components
+ :incrementing-button {:view button-view
+ :props #{:clicks}})
+```
+
+When we register our component, we declare `clicks` as a prop. When we update the `incrementing-button`'s `clicks` property, it will re-render.
+
+To update our component, we use use the `zero.core/on` prop on the root to listen for click events. When the click occurs, `on-click` is called, and it increments the `incrementing-button`'s `clicks` property. `incrementing-button` re-renders automatically.
+
+### Atoms
+
+We can also use ClojureScript's built-in tools for state. Let's look at an example using an atom.
+
+```clojurescript
+(ns increment-counter
+ (:require [zero.core :as z]
+ [zero.config :as zc]
+ [zero.component]))
+
+(defonce clicks*
+ (atom 0))
+
+(defn on-click
+ [_event]
+ (swap! clicks* inc))
+
+(defn button-view
+ [{:keys [clicks]}]
+ [:root> {::z/on {:click on-click}}
+ [:button (str "Clicked " clicks " times")]])
+
+(zc/reg-components
+ :incrementing-button {:view button-view
+ :props {:clicks clicks*}})
+```
+
+Here we have bound the `clicks` prop to an atom. Similar to reagent, when that atom updates, our `incrementing-button` component re-renders.
+
+### App DB
+
+Zero also provides facilities for state management that resemble re-frame.
+
+```clojurescript
+(ns increment-counter.client
+ (:require [zero.core :as z]
+ [zero.config :as zc]
+ [zero.component]
+ [zero.extras.db :as db]))
+
+;; Init db value
+(db/patch! [{:path [:clicks] :value 0}])
+
+(defn button-view
+ [{:keys [clicks]}]
+ [:root> {::z/on {:click (z/act [::db/patch [{:path [:clicks]
+ :fn inc}]])}}
+ [:button (str "Clicked " clicks " times")]])
+
+(zc/reg-components
+ :incrementing-button {:view button-view
+ :props {:clicks (z/bnd ::db/path [:clicks])}})
+```
+
+Here we have an in-memory database for our application. We bind our clicks prop to a path in the database, and then use the `::db/path` effect to update the value at the `:clicks` path. | Typo `::db/path -> ::db/patch`. |
Odin | github_2023 | others | 156 | odtheking | odtheking | @@ -68,7 +70,7 @@ object ArrowAlign : Module(
val frameIndex = ((entityPosition.yCoord - frameGridCorner.yCoord) + (entityPosition.zCoord - frameGridCorner.zCoord) * 5).toInt()
if (entityPosition.xCoord != frameGridCorner.xCoord || currentFrameRotations?.get(frameIndex) == -1 || frameIndex !in 0..24) return
- if (!clicksRemaining.containsKey(frameIndex) && !mc.thePlayer.isSneaking && blockWrong) {
+ if (!clicksRemaining.containsKey(frameIndex) && ((!mc.thePlayer.isSneaking && !invertSneak) || (mc.thePlayer.isSneaking && invertSneak)) && blockWrong) { | Simplify this if statment you can reach the same result using a single condition. |
Odin | github_2023 | others | 146 | odtheking | odtheking | @@ -92,20 +93,20 @@ object ChatCommands : Module(
private fun handleChatCommands(message: String, name: String, channel: ChatChannel) {
val commandsMap = when (channel) {
ChatChannel.PARTY -> mapOf (
- "coords" to coords, "odin" to odin, "boop" to boop, "cf" to cf, "8ball" to eightball, "dice" to dice, "racism" to racism, "tps" to tps, "warp" to warp,
+ "coords" to coords, "odin" to odin, "boop" to boop, "kick" to kick, "cf" to cf, "8ball" to eightball, "dice" to dice, "racism" to racism, "tps" to tps, "warp" to warp,
"warptransfer" to warptransfer, "allinvite" to allinvite, "pt" to pt, "dt" to dt, "m?" to queInstance, "f?" to queInstance, "t?" to queInstance, "time" to time,
"demote" to demote, "promote" to promote
)
ChatChannel.GUILD -> mapOf ("coords" to coords, "odin" to odin, "boop" to boop, "cf" to cf, "8ball" to eightball, "dice" to dice, "racism" to racism, "ping" to ping, "tps" to tps, "time" to time)
- ChatChannel.PRIVATE -> mapOf ("coords" to coords, "odin" to odin, "boop" to boop, "cf" to cf, "8ball" to eightball, "dice" to dice, "racism" to racism, "ping" to ping, "tps" to tps, "invite" to invite, "time" to time)
+ ChatChannel.PRIVATE -> mapOf ("coords" to coords, "odin" to odin, "boop" to boop, "kick" to kick, "cf" to cf, "8ball" to eightball, "dice" to dice, "racism" to racism, "ping" to ping, "tps" to tps, "invite" to invite, "time" to time) | Remove the kick from the help command of private commands |
Odin | github_2023 | others | 142 | odtheking | odtheking | @@ -44,7 +44,7 @@ object DragonPriority {
if (totalPower >= easyPower) {
if (soloDebuff == 1 && playerClass == DungeonClass.Tank && (spawningDragon.any { it == WitherDragonsEnum.Purple } || soloDebuffOnAll)) spawningDragon.sortByDescending { priorityList.indexOf(it) } | please merge the if statements |
Odin | github_2023 | others | 93 | odtheking | freebonsai | @@ -0,0 +1,73 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import net.minecraft.client.Minecraft
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.item.ItemStack
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.Timer
+import kotlin.concurrent.schedule
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft()
+
+ private val swapDelay: Long by NumberSetting("Swap Delay", 10L, 1, 20, unit = "ticks", description = "Superboom swapping delay in ticks.")
+ private val placeDelay: Long by NumberSetting("Place Delay", 10L, 1, 20, unit = "ticks", description = "Placing Superboom delay in ticks.")
+ private val anyBlock: Boolean by BooleanSetting("Any Block", default = false, description = "Place Superboom on any block.")
+
+ @SubscribeEvent
+ fun onLeftClick(event: PlayerInteractEvent) {
+ if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
+ if (anyBlock || isLookingAtCrackedStoneBricks(event.pos)) {
+ val superboomSlot = findSuperboomSlot()
+ if (superboomSlot != -1) {
+ val swapDelayMillis = swapDelay * 50
+ val placeDelayMillis = placeDelay * 50
+
+ Timer().schedule(swapDelayMillis) { | Use the runIn(ticks) function if you already have the settings in ticks. |
Odin | github_2023 | others | 93 | odtheking | freebonsai | @@ -0,0 +1,73 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import net.minecraft.client.Minecraft
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.item.ItemStack
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.Timer
+import kotlin.concurrent.schedule
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft()
+
+ private val swapDelay: Long by NumberSetting("Swap Delay", 10L, 1, 20, unit = "ticks", description = "Superboom swapping delay in ticks.")
+ private val placeDelay: Long by NumberSetting("Place Delay", 10L, 1, 20, unit = "ticks", description = "Placing Superboom delay in ticks.")
+ private val anyBlock: Boolean by BooleanSetting("Any Block", default = false, description = "Place Superboom on any block.")
+
+ @SubscribeEvent
+ fun onLeftClick(event: PlayerInteractEvent) {
+ if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) { | do if () return and do this all in one if statement |
Odin | github_2023 | others | 93 | odtheking | freebonsai | @@ -0,0 +1,73 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import net.minecraft.client.Minecraft
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.item.ItemStack
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.Timer
+import kotlin.concurrent.schedule
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft()
+
+ private val swapDelay: Long by NumberSetting("Swap Delay", 10L, 1, 20, unit = "ticks", description = "Superboom swapping delay in ticks.")
+ private val placeDelay: Long by NumberSetting("Place Delay", 10L, 1, 20, unit = "ticks", description = "Placing Superboom delay in ticks.")
+ private val anyBlock: Boolean by BooleanSetting("Any Block", default = false, description = "Place Superboom on any block.")
+
+ @SubscribeEvent
+ fun onLeftClick(event: PlayerInteractEvent) {
+ if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
+ if (anyBlock || isLookingAtCrackedStoneBricks(event.pos)) {
+ val superboomSlot = findSuperboomSlot()
+ if (superboomSlot != -1) {
+ val swapDelayMillis = swapDelay * 50
+ val placeDelayMillis = placeDelay * 50
+
+ Timer().schedule(swapDelayMillis) {
+ minecraft.thePlayer.inventory.currentItem = superboomSlot
+
+ Timer().schedule(placeDelayMillis) {
+ triggerRightClick()
+ }
+ }
+ } else {
+ minecraft.thePlayer.addChatMessage(ChatComponentText("No item named 'Superboom TNT' could be found."))
+ }
+ }
+ }
+ }
+
+ private fun findSuperboomSlot(): Int { | Use ItemUtils.getItemSlot() instead of this |
Odin | github_2023 | others | 93 | odtheking | freebonsai | @@ -0,0 +1,73 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import net.minecraft.client.Minecraft
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.item.ItemStack
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.Timer
+import kotlin.concurrent.schedule
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft()
+
+ private val swapDelay: Long by NumberSetting("Swap Delay", 10L, 1, 20, unit = "ticks", description = "Superboom swapping delay in ticks.")
+ private val placeDelay: Long by NumberSetting("Place Delay", 10L, 1, 20, unit = "ticks", description = "Placing Superboom delay in ticks.")
+ private val anyBlock: Boolean by BooleanSetting("Any Block", default = false, description = "Place Superboom on any block.")
+
+ @SubscribeEvent
+ fun onLeftClick(event: PlayerInteractEvent) {
+ if (event.action == PlayerInteractEvent.Action.LEFT_CLICK_BLOCK) {
+ if (anyBlock || isLookingAtCrackedStoneBricks(event.pos)) {
+ val superboomSlot = findSuperboomSlot()
+ if (superboomSlot != -1) {
+ val swapDelayMillis = swapDelay * 50
+ val placeDelayMillis = placeDelay * 50
+
+ Timer().schedule(swapDelayMillis) {
+ minecraft.thePlayer.inventory.currentItem = superboomSlot
+
+ Timer().schedule(placeDelayMillis) {
+ triggerRightClick()
+ }
+ }
+ } else {
+ minecraft.thePlayer.addChatMessage(ChatComponentText("No item named 'Superboom TNT' could be found."))
+ }
+ }
+ }
+ }
+
+ private fun findSuperboomSlot(): Int {
+ val inventory = minecraft.thePlayer.inventory.mainInventory
+ for (i in inventory.indices) {
+ val itemStack: ItemStack? = inventory[i]
+ if (itemStack != null && itemStack.displayName.contains("Superboom TNT", true)) {
+ return i
+ }
+ }
+ return -1
+ }
+
+ private fun isLookingAtCrackedStoneBricks(pos: BlockPos): Boolean {
+ val block: Block = minecraft.theWorld.getBlockState(pos).block
+ return block is BlockStoneBrick && block.getMetaFromState(minecraft.theWorld.getBlockState(pos)) == BlockStoneBrick.CRACKED_META
+ }
+
+ private fun triggerRightClick() { | PlayerUtils.rightclick |
Odin | github_2023 | others | 93 | odtheking | odtheking | @@ -0,0 +1,58 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.runIn
+import me.odinclient.utils.skyblock.PlayerUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft() | Do not declare this again there is already a global variable for this
Don't copy paste random stuff into this mod |
Odin | github_2023 | others | 93 | odtheking | odtheking | @@ -0,0 +1,58 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.runIn
+import me.odinclient.utils.skyblock.PlayerUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft()
+
+ private val placeDelay: Long by NumberSetting("Place Delay", 10L, 1, 20, unit = "ticks", description = "Placing Superboom delay in ticks.")
+ private val anyBlock: Boolean by BooleanSetting("Any Block", default = false, description = "Place Superboom on any block.")
+
+ @SubscribeEvent
+ fun onLeftClick(event: PlayerInteractEvent) {
+ if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK || (!anyBlock && !isLookingAtCrackedStoneBricks(event.pos))) return
+
+ val superboomSlot = getItemSlot("Superboom TNT") ?: return minecraft.thePlayer.addChatMessage(ChatComponentText("No item named 'Superboom TNT' could be found."))
+
+ schedulePlace(superboomSlot)
+ }
+
+ private fun schedulePlace(superboomSlot: Int) {
+ // Instantly swap to Superboom
+ runIn(3) {
+ minecraft.thePlayer.inventory.currentItem = superboomSlot
+ }
+
+ // Delay for placing the item
+ runIn(placeDelay.toInt()) {
+ triggerRightClick()
+ }
+ }
+
+ private fun isLookingAtCrackedStoneBricks(pos: BlockPos): Boolean {
+ val block: Block = minecraft.theWorld.getBlockState(pos).block | Use Odin's method for getting a block |
Odin | github_2023 | others | 93 | odtheking | odtheking | @@ -1,22 +1,22 @@
-pluginManagement {
| Don't touch this file |
Odin | github_2023 | others | 93 | odtheking | odtheking | @@ -0,0 +1,58 @@
+package me.odinclient.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.runIn
+import me.odinclient.utils.skyblock.PlayerUtils
+import net.minecraft.client.Minecraft
+import net.minecraft.util.BlockPos
+import net.minecraft.util.ChatComponentText
+import net.minecraft.block.Block
+import net.minecraft.block.BlockStoneBrick
+import net.minecraftforge.event.entity.player.PlayerInteractEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object AutoBoom : Module(
+ name = "Auto Superboom",
+ description = "Places a superboom when you left-click.",
+ category = Category.DUNGEON,
+ tag = TagType.RISKY
+) {
+ private val minecraft: Minecraft = Minecraft.getMinecraft()
+
+ private val placeDelay: Long by NumberSetting("Place Delay", 10L, 1, 20, unit = "ticks", description = "Placing Superboom delay in ticks.")
+ private val anyBlock: Boolean by BooleanSetting("Any Block", default = false, description = "Place Superboom on any block.")
+
+ @SubscribeEvent
+ fun onLeftClick(event: PlayerInteractEvent) {
+ if (event.action != PlayerInteractEvent.Action.LEFT_CLICK_BLOCK || (!anyBlock && !isLookingAtCrackedStoneBricks(event.pos))) return
+
+ val superboomSlot = getItemSlot("Superboom TNT") ?: return minecraft.thePlayer.addChatMessage(ChatComponentText("No item named 'Superboom TNT' could be found.")) | Use Odin's own methods for sending a mod message
Do not copy paste random stuff into this mod |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) { | Use Odin's Input event |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) {
+ if (etherOnLC && event.button == 0 && event.buttonstate) { | Merge if statement |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) {
+ if (etherOnLC && event.button == 0 && event.buttonstate) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ if (!etherOnShift) {
+ performEtherwarp(withSneak = true) | Inline the if statement |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) {
+ if (etherOnLC && event.button == 0 && event.buttonstate) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ if (!etherOnShift) {
+ performEtherwarp(withSneak = true)
+ } else {
+ performEtherwarp(withSneak = false)
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onKeyInput(event: KeyInputEvent) { | Use Odin's input events |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) {
+ if (etherOnLC && event.button == 0 && event.buttonstate) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ if (!etherOnShift) {
+ performEtherwarp(withSneak = true)
+ } else {
+ performEtherwarp(withSneak = false)
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onKeyInput(event: KeyInputEvent) {
+ if (etherOnShift && mc.gameSettings.keyBindSneak.isKeyDown) { | merge if statements |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) {
+ if (etherOnLC && event.button == 0 && event.buttonstate) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ if (!etherOnShift) {
+ performEtherwarp(withSneak = true)
+ } else {
+ performEtherwarp(withSneak = false)
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onKeyInput(event: KeyInputEvent) {
+ if (etherOnShift && mc.gameSettings.keyBindSneak.isKeyDown) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ performEtherwarp(withSneak = false)
+ }
+ }
+ }
+
+ private fun performEtherwarp(withSneak: Boolean) {
+ if (withSneak) {
+ KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.keyCode, true)
+ mc.thePlayer.isSneaking = true
+ }
+
+ Timer().schedule(500) { | Use Odin's runin function |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -0,0 +1,61 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.utils.skyblock.isHolding
+import net.minecraftforge.client.event.MouseEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.InputEvent.KeyInputEvent
+import net.minecraft.client.settings.KeyBinding
+import kotlin.concurrent.schedule
+import java.util.Timer
+
+object EasyEther : Module(
+ name = "Easy Etherwarp",
+ description = "Etherwarps when a key/button is pressed.",
+ category = Category.SKYBLOCK,
+ tag = TagType.RISKY
+) {
+ private val etherOnLC: Boolean by BooleanSetting("On Left Click", true, description = "Etherwarps on left click.")
+ private val etherOnShift: Boolean by BooleanSetting("On Sneak", false, description = "Etherwarps on sneak.")
+
+ @SubscribeEvent
+ fun onMouseEvent(event: MouseEvent) {
+ if (etherOnLC && event.button == 0 && event.buttonstate) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ if (!etherOnShift) {
+ performEtherwarp(withSneak = true)
+ } else {
+ performEtherwarp(withSneak = false)
+ }
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onKeyInput(event: KeyInputEvent) {
+ if (etherOnShift && mc.gameSettings.keyBindSneak.isKeyDown) {
+ if (isHolding("ASPECT_OF_THE_VOID")) {
+ performEtherwarp(withSneak = false)
+ }
+ }
+ }
+
+ private fun performEtherwarp(withSneak: Boolean) {
+ if (withSneak) {
+ KeyBinding.setKeyBindState(mc.gameSettings.keyBindSneak.keyCode, true)
+ mc.thePlayer.isSneaking = true | mc.thePlayer is nullable handle that |
Odin | github_2023 | others | 95 | odtheking | odtheking | @@ -1,22 +1,22 @@
-pluginManagement {
| Don't touch this file |
Odin | github_2023 | others | 121 | odtheking | freebonsai | @@ -135,7 +136,12 @@ object DungeonWaypoints : Module(
if ((DungeonUtils.inBoss || !DungeonUtils.inDungeons) && !LocationUtils.currentArea.isArea(Island.SinglePlayer)) return
val room = DungeonUtils.currentFullRoom ?: return
startProfile("Dungeon Waypoints")
- glList = RenderUtils.drawBoxes(room.waypoints, glList, disableDepth)
+
+
+ glList = RenderUtils.drawBoxes(room.waypoints.map { | Doing the color changing inside the drawboxes function makes a lot more sense. |
Odin | github_2023 | others | 127 | odtheking | freebonsai | @@ -39,14 +40,13 @@ object BeamsSolver {
private var currentLanternPairs = ConcurrentHashMap<BlockPos, Pair<BlockPos, Color>>()
fun enterDungeonRoom(event: RoomEnterEvent) {
- val room = event.fullRoom?.room ?: return // <-- orb = orb.orb
+ val room = event.room ?: return
if (room.data.name != "Creeper Beams") return reset()
currentLanternPairs.clear()
lanternPairs.forEach {
- val pos = room.vec2.addRotationCoords(room.rotation, x = it[0], z = it[2]).let { vec -> BlockPos(vec.x, it[1], vec.z) }
-
- val pos2 = room.vec2.addRotationCoords(room.rotation, x = it[3], z = it[5]).let { vec -> BlockPos(vec.x, it[4], vec.z) }
+ val pos = room.getRealCoords(BlockPos(it[0], it[1], it[2])).toBlockPos() | Make another getRealCoords function where it takes Integers as parameters instead maybe? |
Odin | github_2023 | others | 127 | odtheking | freebonsai | @@ -31,17 +31,18 @@ object BoulderSolver {
}
fun onRoomEnter(event: DungeonEvents.RoomEnterEvent) {
- val room = event.fullRoom?.room ?: return reset()
+ val room = event.room ?: return reset()
if (room.data.name != "Boulder") return reset()
+ val roomComponent = room.roomComponents.firstOrNull() ?: return reset()
var str = ""
for (z in -3..2) {
for (x in -3..3) {
- room.vec2.addRotationCoords(room.rotation, x * 3, z * 3).let { str += if (getBlockIdAt(BlockPos(it.x, 66, it.z)) == 0) "0" else "1" }
+ roomComponent.vec3.addRotationCoords(room.rotation, x * 3, z * 3).let { str += if (getBlockIdAt(BlockPos(it.xCoord, 66.0, it.zCoord)) == 0) "0" else "1" } | Use the getBlockIdAt with integer parameters. |
Odin | github_2023 | others | 127 | odtheking | freebonsai | @@ -42,10 +43,10 @@ object IceFillSolver {
}
fun enterDungeonRoom(event: RoomEnterEvent) {
- val room = event.fullRoom?.room ?: return
+ val room = event.room ?: return
if (room.data.name != "Ice Fill" || currentPatterns.isNotEmpty()) return
- scanAllFloors(room.vec3.addRotationCoords(room.rotation, 8), room.rotation)
+ scanAllFloors(room.getRealCoords(Vec3(15.0, 70.0, 7.0)), room.rotation) | Same as earlier, integer parameters would be nicer. |
Odin | github_2023 | others | 127 | odtheking | freebonsai | @@ -54,14 +55,12 @@ object QuizSolver {
}
fun enterRoomQuiz(event: RoomEnterEvent) {
- val room = event.fullRoom?.room ?: return
+ val room = event.room ?: return
if (room.data.name != "Quiz") return
- room.vec3.addRotationCoords(room.rotation, 0, 6).let { middleAnswerBlock ->
- triviaOptions[0].vec3 = middleAnswerBlock.addRotationCoords(room.rotation, -5, 3)
- triviaOptions[1].vec3 = middleAnswerBlock
- triviaOptions[2].vec3 = middleAnswerBlock.addRotationCoords(room.rotation, 5, 3)
- }
+ triviaOptions[0].vec3 = room.getRealCoords(Vec3(20.0, 70.0, 6.0)) | Not very related to your changes, but TriviaAnswer should take a blockPos instead of a Vec3. |
Odin | github_2023 | others | 127 | odtheking | freebonsai | @@ -54,14 +55,12 @@ object QuizSolver {
}
fun enterRoomQuiz(event: RoomEnterEvent) {
- val room = event.fullRoom?.room ?: return
+ val room = event.room ?: return | fun enterRoomQuiz(event: RoomEnterEvent) = with(event.room) {
//
}
Would make the val room useless, and code would be cleaner. This could be implemented very many places in the mod, so it's something to look into. |
Odin | github_2023 | others | 127 | odtheking | freebonsai | @@ -22,9 +23,10 @@ object TPMazeSolver {
private var visited = CopyOnWriteArraySet<BlockPos>()
fun onRoomEnter(event: DungeonEvents.RoomEnterEvent) {
- val room = event.fullRoom?.room ?: return
+ val room = event.room ?: return
if (room.data.name != "Teleport Maze") return
- tpPads = BlockPos.getAllInBox(room.vec3.addRotationCoords(room.rotation, -16, -16).addVec(y = -1).toBlockPos(), room.vec3.addRotationCoords(room.rotation, 16, 16).addVec(y = -1).toBlockPos())
+
+ tpPads = BlockPos.getAllInBox(room.getRealCoords(Vec3(30.0, 69.0, 30.0)).toBlockPos(), room.getRealCoords(Vec3(0.0, 69.0, 0.0)).toBlockPos()) | make the BlockPos version of getRealCoords also return a BlockPos, and you wouldn't need toBlockPos. |
Odin | github_2023 | others | 129 | odtheking | odtheking | @@ -139,13 +139,5 @@ object RenderOptimizer : Module(
entity.alwaysRenderNameTag = false
}
- private fun getHealerFairyTextureValue(armorStand: EntityArmorStand?): String? {
- return armorStand?.heldItem
- ?.tagCompound
- ?.getCompoundTag("SkullOwner")
- ?.getCompoundTag("Properties")
- ?.getTagList("textures", 10)
- ?.getCompoundTagAt(0)
- ?.getString("Value")
- }
+ private fun getHealerFairyTextureValue(armorStand: EntityArmorStand?): String? = armorStand?.heldItem?.skullTexture | Doesn't need to be a function |
Odin | github_2023 | others | 129 | odtheking | odtheking | @@ -89,7 +90,17 @@ object ModuleManager {
@SubscribeEvent
fun onTick(event: TickEvent.ClientTickEvent) {
if (event.phase != TickEvent.Phase.START) return
- tickTasks.removeAll {
+ tickTasks.tickTaskTick()
+ }
+
+ @SubscribeEvent
+ fun onServerTick(event: RealServerTick) {
+ tickTasks.tickTaskTick(true)
+ }
+
+ private fun MutableList<TickTask>.tickTaskTick(server: Boolean = false) { | can get a better naming? |
Odin | github_2023 | others | 129 | odtheking | odtheking | @@ -212,20 +214,20 @@ object BloodCamp : Module(
currentTickTime += 50
}
- //Skull data gotten by DocilElm
-
private val watcherSkulls = setOf(
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNGNlYzQwMDA4ZTFjMzFjMTk4NGY0ZDY1MGFiYjM0MTBmMjAzNzExOWZkNjI0YWZjOTUzNTYzYjczNTE1YTA3NyJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTVjMWRjNDdhMDRjZTU3MDAxYThiNzI2ZjAxOGNkZWY0MGI3ZWE5ZDdiZDZkODM1Y2E0OTVhMGVmMTY5Zjg5MyJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYmY2ZTFlN2VkMzY1ODZjMmQ5ODA1NzAwMmJjMWFkYzk4MWUyODg5ZjdiZDdiNWIzODUyYmM1NWNjNzgwMjIwNCJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkNjFlODA1NWY2ZWU5N2FiNWI2MTk2YThkN2VjOTgwNzhhYzM3ZTAwMzc2MTU3YjZiNTIwZWFhYTJmOTNhZiJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjM3ZGQxOGI1OTgzYTc2N2U1NTZkYzY0NDI0YWY0YjlhYmRiNzVkNGM5ZThiMDk3ODE4YWZiYzQzMWJmMGUwOSJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTY2MmI2ZmI0YjhiNTg2ZGM0Y2RmODAzYjA0NDRkOWI0MWQyNDVjZGY2NjhkYWIzOGZhNmMwNjRhZmU4ZTQ2MSJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMjczOWQ3ZjRlNjZhN2RiMmVhNmNkNDE0ZTRjNGJhNDFkZjdhOTI0NTVjOWZjNDJjYWFiMDE0NjY1YzM2N2FkNSJ9fX0K",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvMTdkYjE5MjNkMDNjNGVmNGU5ZjZlODcyYzVhNmFkMjU3OGIxYWZmMmIyODFmYmMzZmZhNzQ2NmM4MjVmYjkifX19",
- "eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjVmMGQ3OGZlMzhkMWQ3Zjc1ZjA4Y2RjZjJhMTg1NWQ2ZGEwMzM3ZTExNGEzYzYzZTNiZjNjNjE4YmM3MzJiMCJ9fX0K"
+ "ewogICJ0aW1lc3RhbXAiIDogMTY5NzMwOTQxNzI1NiwKICAicHJvZmlsZUlkIiA6ICJjYjYxY2U5ODc4ZWI0NDljODA5MzliNWYxNTkwMzE1MiIsCiAgInByb2ZpbGVOYW1lIiA6ICJWb2lkZWRUcmFzaDUxODUiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNTY2MmI2ZmI0YjhiNTg2ZGM0Y2RmODAzYjA0NDRkOWI0MWQyNDVjZGY2NjhkYWIzOGZhNmMwNjRhZmU4ZTQ2MSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9",
+ "ewogICJ0aW1lc3RhbXAiIDogMTcxOTYwNjM1MjMyMiwKICAicHJvZmlsZUlkIiA6ICI3MmY5MTdjNWQyNDU0OTk0YjlmYzQ1YjVhM2YyMjIzMCIsCiAgInByb2ZpbGVOYW1lIiA6ICJUaGF0X0d1eV9Jc19NZSIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS8yNzM5ZDdmNGU2NmE3ZGIyZWE2Y2Q0MTRlNGM0YmE0MWRmN2E5MjQ1NWM5ZmM0MmNhYWIwMTQ2NjVjMzY3YWQ1IiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=",
+ "ewogICJ0aW1lc3RhbXAiIDogMTcxOTYwNjI5MjgzNiwKICAicHJvZmlsZUlkIiA6ICIzZDIxZTYyMTk2NzQ0Y2QwYjM3NjNkNTU3MWNlNGJlZSIsCiAgInByb2ZpbGVOYW1lIiA6ICJTcl83MUJsYWNrYmlyZCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iZjZlMWU3ZWQzNjU4NmMyZDk4MDU3MDAyYmMxYWRjOTgxZTI4ODlmN2JkN2I1YjM4NTJiYzU1Y2M3ODAyMjA0IiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=",
+ "ewogICJ0aW1lc3RhbXAiIDogMTY5NzIzODQ0NjgxMiwKICAicHJvZmlsZUlkIiA6ICJmMjc0YzRkNjI1MDQ0ZTQxOGVmYmYwNmM3NWIyMDIxMyIsCiAgInByb2ZpbGVOYW1lIiA6ICJIeXBpZ3NlbCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS80Y2VjNDAwMDhlMWMzMWMxOTg0ZjRkNjUwYWJiMzQxMGYyMDM3MTE5ZmQ2MjRhZmM5NTM1NjNiNzM1MTVhMDc3IiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=",
+ "ewogICJ0aW1lc3RhbXAiIDogMTcxOTYwNjAwOTg2NywKICAicHJvZmlsZUlkIiA6ICJiMGQ0YjI4YmMxZDc0ODg5YWYwZTg2NjFjZWU5NmFhYiIsCiAgInByb2ZpbGVOYW1lIiA6ICJNaW5lU2tpbl9vcmciLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvYjM3ZGQxOGI1OTgzYTc2N2U1NTZkYzY0NDI0YWY0YjlhYmRiNzVkNGM5ZThiMDk3ODE4YWZiYzQzMWJmMGUwOSIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9",
+ "ewogICJ0aW1lc3RhbXAiIDogMTcxOTYwNTkyNDIwNSwKICAicHJvZmlsZUlkIiA6ICIzZDIxZTYyMTk2NzQ0Y2QwYjM3NjNkNTU3MWNlNGJlZSIsCiAgInByb2ZpbGVOYW1lIiA6ICJTcl83MUJsYWNrYmlyZCIsCiAgInNpZ25hdHVyZVJlcXVpcmVkIiA6IHRydWUsCiAgInRleHR1cmVzIiA6IHsKICAgICJTS0lOIiA6IHsKICAgICAgInVybCIgOiAiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9mNWYwZDc4ZmUzOGQxZDdmNzVmMDhjZGNmMmExODU1ZDZkYTAzMzdlMTE0YTNjNjNlM2JmM2M2MThiYzczMmIwIiwKICAgICAgIm1ldGFkYXRhIiA6IHsKICAgICAgICAibW9kZWwiIDogInNsaW0iCiAgICAgIH0KICAgIH0KICB9Cn0=",
+ "ewogICJ0aW1lc3RhbXAiIDogMTU4OTU1MDkyNjM2MSwKICAicHJvZmlsZUlkIiA6ICI0ZDcwNDg2ZjUwOTI0ZDMzODZiYmZjOWMxMmJhYjRhZSIsCiAgInByb2ZpbGVOYW1lIiA6ICJzaXJGYWJpb3pzY2hlIiwKICAic2lnbmF0dXJlUmVxdWlyZWQiIDogdHJ1ZSwKICAidGV4dHVyZXMiIDogewogICAgIlNLSU4iIDogewogICAgICAidXJsIiA6ICJodHRwOi8vdGV4dHVyZXMubWluZWNyYWZ0Lm5ldC90ZXh0dXJlLzUxOTY3ZGI1ZTMxOTk5MTYyNTIwMjE5MDNjZjRlOTk1MmVmN2NlYzIyMGZhYWNhMWJhNzliYWZlNTkzOGJkODAiCiAgICB9CiAgfQp9",
+ "ewogICJ0aW1lc3RhbXAiIDogMTcxOTYwNjIxMjc1NSwKICAicHJvZmlsZUlkIiA6ICI2NGRiNmMwNTliOTk0OTM2YTY0M2QwODEwODE0ZmJkMyIsCiAgInByb2ZpbGVOYW1lIiA6ICJUaGVTaWx2ZXJEcmVhbXMiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvOWZkNjFlODA1NWY2ZWU5N2FiNWI2MTk2YThkN2VjOTgwNzhhYzM3ZTAwMzc2MTU3YjZiNTIwZWFhYTJmOTNhZiIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9", //i hate hypixel
+ "ewogICJ0aW1lc3RhbXAiIDogMTcxOTYwNjIzOTU4NiwKICAicHJvZmlsZUlkIiA6ICJhYWZmMDUwYTExOTk0NzM1YjEyNDVlNDk0MGFlZjY4NCIsCiAgInByb2ZpbGVOYW1lIiA6ICJMYXN0SW1tb3J0YWwiLAogICJzaWduYXR1cmVSZXF1aXJlZCIgOiB0cnVlLAogICJ0ZXh0dXJlcyIgOiB7CiAgICAiU0tJTiIgOiB7CiAgICAgICJ1cmwiIDogImh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZTVjMWRjNDdhMDRjZTU3MDAxYThiNzI2ZjAxOGNkZWY0MGI3ZWE5ZDdiZDZkODM1Y2E0OTVhMGVmMTY5Zjg5MyIsCiAgICAgICJtZXRhZGF0YSIgOiB7CiAgICAgICAgIm1vZGVsIiA6ICJzbGltIgogICAgICB9CiAgICB9CiAgfQp9" //I really hate hypixel | does that mean u got all of them? |
Odin | github_2023 | others | 130 | odtheking | odtheking | @@ -42,7 +45,8 @@ object KuudraReminders : Module(
PlayerUtils.alert("Fresh Tools", displayText = displayText, playSound = playSound)
}
- onMessage(Regex("Used Extreme Focus! \\((\\d+) Mana\\)"), { manaDrain && enabled }) {
+ onMessage(Regex("Used Extreme Focus! \\((\\d+) Mana\\)"), { manaDrain && enabled}) {
+ if (onlyKuudra && !KuudraUtils.inKuudra) return@onMessage | Move the check to inside the lambda in the onMessage
Resolve conflicts
and ill merge |
Odin | github_2023 | others | 126 | odtheking | odtheking | @@ -52,8 +52,8 @@ object DungeonWaypoints : Module(
tag = TagType.NEW
) {
private var allowEdits by BooleanSetting("Allow Edits", false, description = "Allows you to edit waypoints.")
- private var reachEdits by BooleanSetting("Reach Edits", false, description = "Extends the reach of edit mode.").withDependency { allowEdits }
- private var reachColor by ColorSetting("Reach Color", default = Color(0, 255, 213, 0.43f), description = "Color of the reach box highlight.", allowAlpha = true).withDependency { reachEdits && allowEdits }
+ private var allowMidair by BooleanSetting("Allow Midair", default = false, description = "Allows waypoints to be placed midair if they reach the end of distance without hitting a block").withDependency { allowEdits} | add a dot at the end of the description |
Odin | github_2023 | others | 126 | odtheking | odtheking | @@ -181,26 +194,44 @@ object DungeonWaypoints : Module(
}
endProfile()
- if (reachEdits && allowEdits) {
- reachPos = EtherWarpHelper.getEtherPos(mc.thePlayer.renderVec, mc.thePlayer.rotationYaw, mc.thePlayer.rotationPitch)
- reachPos?.pos?.let {
- if (useBlockSize) Renderer.drawStyledBlock(it, reachColor, style = if (filled) 0 else 1, 1, !throughWalls)
- else Renderer.drawStyledBox(AxisAlignedBB(it.x + 0.5 - (size / 2), it.y + .5 - (size / 2), it.z + .5 - (size / 2), it.x + .5 + (size / 2), it.y + .5 + (size / 2), it.z + .5 + (size / 2)).outlineBounds(), reachColor, style = if (filled) 0 else 1, 1, !throughWalls)
- }
+
+ reachPosition?.takeIf { allowEdits }?.let {
+ if (useBlockSize) Renderer.drawStyledBlock(it, reachColor, style = if (filled) 0 else 1, 1, !throughWalls)
+ else Renderer.drawStyledBox(AxisAlignedBB(it.x + 0.5, it.y + .5, it.z + .5, it.x + .5, it.y + .5, it.z + .5).outlineBounds(), reachColor, style = if (filled) 0 else 1, 1, !throughWalls)
}
}
@SubscribeEvent
fun onRenderOverlay(event: RenderGameOverlayEvent.Post) {
if (mc.currentScreen != null || event.type != RenderGameOverlayEvent.ElementType.ALL || !allowEdits || !editText) return
val sr = ScaledResolution(mc)
- val stats = "type: ${WaypointType.getByInt(waypointType)}, filled: $filled, depth: $throughWalls"
+ val pos = reachPosition
+ val (text, editText) = pos?.add(offset)?.let {
+ val room = DungeonUtils.currentFullRoom ?: return
+ val vec = room.getRelativeCoords(it.add(offset).toVec3())
+ val waypoint = getWaypoints(room).find { it.toVec3().equal(vec) }
+
+ val text = waypoint?.let {"§fType: §5${waypoint.type?.displayName ?: "None"}${waypoint.timer?.let { "§7, §fTimer: §a${it.displayName}" } ?: ""}" }
+ ?: "§fType: §5${WaypointType.getByInt(waypointType)?.displayName ?: "None"}§7, §r#${selectedColor.hex}§7, ${if (filled) "§2Filled" else "§3Outline"}§7, ${if (throughWalls) "§cThrough Walls§7, " else ""}${if (useBlockSize) "§2Block Size" else "§3Size: $size"}${TimerType.getType()?.let { "§7, §fTimer: §a${it.displayName}" } ?: ""}"
+
+
+ text to "§fEditing Waypoints §8|§f ${waypoint?.let { "Viewing" } ?: "Placing"}"
+ } ?: ("" to "Editing Waypoints")
+
scale(2f / sr.scaleFactor, 2f / sr.scaleFactor, 1f)
- mc.fontRendererObj.drawString("Editing Waypoints", mc.displayWidth / 4 - mc.fontRendererObj.getStringWidth("Editing Waypoints") / 2, mc.displayHeight / 4 + 10, Color.WHITE.withAlpha(.5f).rgba)
- mc.fontRendererObj.drawString(stats, mc.displayWidth / 4 - mc.fontRendererObj.getStringWidth(stats) / 2, mc.displayHeight / 4 + 20, Color.WHITE.withAlpha(.5f).rgba)
+ mcText(editText, mc.displayWidth / 4, mc.displayHeight / 4 + 10, 1f, Color.WHITE.withAlpha(.8f))
+ mcText(text,mc.displayWidth / 4, mc.displayHeight / 4 + 20, 1f, selectedColor)
scale(sr.scaleFactor / 2f, sr.scaleFactor / 2f, 1f)
}
+ @SubscribeEvent
+ fun onMouseInput(event: MouseEvent) {
+ if (allowEdits && event.dwheel.sign != 0) { | use return |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -20,6 +26,74 @@ import net.minecraft.util.ChatComponentText
val devCommand = commodore("oddev") {
+ literal("drags") {
+ runs { text: GreedyString ->
+ WitherDragonsEnum.entries.forEach {
+ if (text.string.lowercase().contains(it.name.lowercase())) {
+ when (it.name) {
+ "Red" -> sendChatMessage("/particle flame 27 18 60 1 1 1 1 100 force")
+ "Orange" -> sendChatMessage("/particle flame 84 18 56 1 1 1 1 100 force")
+ "Green" -> sendChatMessage("/particle flame 26 18 95 1 1 1 1 100 force")
+ "Blue" -> sendChatMessage("/particle flame 84 18 95 1 1 1 1 100 force")
+ "Purple" -> sendChatMessage("/particle flame 57 18 125 1 1 1 1 100 force")
+ }
+ }
+ }
+ }
+
+ literal("reset") {
+ runs {
+ WitherDragonsEnum.entries.forEach { | Add reset function for the enum maybe? |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -40,6 +54,46 @@ enum class WitherDragonsEnum (
None(Vec3(0.0, 0.0, 0.0), AxisAlignedBB(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), 'f', Color.WHITE,
0.0..0.0, 0.0..0.0);
+
+ fun setAlive(entityId: Int) {
+ state = WitherDragonState.ALIVE
+
+ timeToSpawn = 100
+ timesSpawned += 1
+ this.entityId = entityId
+ spawnedTime = System.currentTimeMillis()
+ isSprayed = false
+
+ if (sendArrowHit && WitherDragons.enabled) arrowSpawn(this)
+ if (resetOnDragons && WitherDragons.enabled) onDragonSpawn()
+ if (sendSpawned && WitherDragons.enabled) {
+ val numberSuffix = when (timesSpawned) { | There is probably a kotlin std function to do this. |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -20,6 +26,54 @@ import net.minecraft.util.ChatComponentText
val devCommand = commodore("oddev") {
+ literal("drags") {
+ runs { text: GreedyString ->
+ WitherDragonsEnum.entries.forEach {
+ if (text.string.lowercase().contains(it.name.lowercase())) {
+ when (it.name) {
+ "Red" -> sendChatMessage("/particle flame 27 18 60 1 1 1 1 100 force")
+ "Orange" -> sendChatMessage("/particle flame 84 18 56 1 1 1 1 100 force")
+ "Green" -> sendChatMessage("/particle flame 26 18 95 1 1 1 1 100 force")
+ "Blue" -> sendChatMessage("/particle flame 84 18 95 1 1 1 1 100 force")
+ "Purple" -> sendChatMessage("/particle flame 57 18 125 1 1 1 1 100 force")
+ }
+ }
+ }
+ }
+
+ literal("reset") {
+ runs { soft: Boolean? -> | why not .runs |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -117,13 +117,23 @@ object BloodCamp : Module(
fun onTick() {
entityList.ifEmpty { return }
watcher.removeAll {it.isDead}
- entityList.forEach { (entity, data) ->
- if (watcher.none { it.getDistanceToEntity(entity) < 20 }) return@forEach
+ }
+
+ private fun onPacketLookMove(packet: S17PacketEntityLookMove) {
+ val entity = packet.getEntity(mc.theWorld) as? EntityArmorStand ?: return
+ if (!watcher.any { it.getDistanceToEntity(entity) < 20 }) return
+
+ if (entity.getEquipmentInSlot(4)?.item != Items.skull || !allowedMobSkulls.contains(getSkullValue(entity))) return
+
+ if (entity !in entityList) entityList[entity] = EntityData(startVector = entity.positionVector, started = tickTime, firstSpawns = firstSpawns)
+
+ if (watcher.none { it.getDistanceToEntity(entity) < 20 }) return | Use || and compact most of this to a singular if statement |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -14,55 +11,36 @@ import me.odinmain.features.impl.floor7.WitherDragons.sendTime
import me.odinmain.features.impl.skyblock.ArrowHit.onDragonSpawn
import me.odinmain.features.impl.skyblock.ArrowHit.resetOnDragons
import me.odinmain.utils.isVecInXZ
+import me.odinmain.utils.skyblock.PlayerUtils
import me.odinmain.utils.skyblock.modMessage
import net.minecraft.entity.boss.EntityDragon
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.init.Blocks
import net.minecraft.item.Item
import net.minecraft.network.play.server.S04PacketEntityEquipment
+import net.minecraft.network.play.server.S0FPacketSpawnMob
+import net.minecraft.network.play.server.S1CPacketEntityMetadata
+import net.minecraft.util.Vec3
import net.minecraftforge.event.entity.EntityJoinWorldEvent
-import net.minecraftforge.event.entity.living.LivingDeathEvent
object DragonCheck {
var lastDragonDeath: WitherDragonsEnum = WitherDragonsEnum.None
- var dragonEntityList = emptyList<EntityDragon>()
+ val dragonEntityList = mutableListOf<EntityDragon>()
- fun dragonJoinWorld(event: EntityJoinWorldEvent) {
- val entity = event.entity as? EntityDragon ?: return
- val dragon = WitherDragonsEnum.entries.find { isVecInXZ(entity.positionVector, it.boxesDimensions) } ?: return
- if (dragon.state == WitherDragonState.DEAD) return
-
- dragon.state = WitherDragonState.ALIVE
- dragon.timeToSpawn = 100
- dragon.timesSpawned += 1
- dragon.entity = entity
- dragon.spawnedTime = System.currentTimeMillis()
- dragon.isSprayed = false
-
- if (sendArrowHit && WitherDragons.enabled) arrowSpawn(dragon)
- if (resetOnDragons && WitherDragons.enabled) onDragonSpawn()
- if (sendSpawned && WitherDragons.enabled) {
- val numberSuffix = when (dragon.timesSpawned) {
- 1 -> "st"
- 2 -> "nd"
- 3 -> "rd"
- else -> "th"
- }
- modMessage("§${dragon.colorCode}${dragon.name} §fdragon spawned. This is the §${dragon.colorCode}${dragon.timesSpawned}${numberSuffix}§f time it has spawned.")
- }
+ fun dragonUpdate(packet: S1CPacketEntityMetadata) {
+ val dragon = WitherDragonsEnum.entries.find { it.entityId == packet.entityId } ?: return
+ if (dragon.entity == null) return dragon.updateEntity(packet.entityId)
+ val health = packet.func_149376_c().find { it.dataValueId == 6 }?.`object` as? Float ?: return
+ if (health > 0 || dragon.state == WitherDragonState.DEAD) return
+ dragon.setDead() | Since there is only one loc after the if statement, it should be inverted instead of it returning. |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -14,55 +11,36 @@ import me.odinmain.features.impl.floor7.WitherDragons.sendTime
import me.odinmain.features.impl.skyblock.ArrowHit.onDragonSpawn
import me.odinmain.features.impl.skyblock.ArrowHit.resetOnDragons
import me.odinmain.utils.isVecInXZ
+import me.odinmain.utils.skyblock.PlayerUtils
import me.odinmain.utils.skyblock.modMessage
import net.minecraft.entity.boss.EntityDragon
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.init.Blocks
import net.minecraft.item.Item
import net.minecraft.network.play.server.S04PacketEntityEquipment
+import net.minecraft.network.play.server.S0FPacketSpawnMob
+import net.minecraft.network.play.server.S1CPacketEntityMetadata
+import net.minecraft.util.Vec3
import net.minecraftforge.event.entity.EntityJoinWorldEvent
-import net.minecraftforge.event.entity.living.LivingDeathEvent
object DragonCheck {
var lastDragonDeath: WitherDragonsEnum = WitherDragonsEnum.None
- var dragonEntityList = emptyList<EntityDragon>()
+ val dragonEntityList = mutableListOf<EntityDragon>()
- fun dragonJoinWorld(event: EntityJoinWorldEvent) {
- val entity = event.entity as? EntityDragon ?: return
- val dragon = WitherDragonsEnum.entries.find { isVecInXZ(entity.positionVector, it.boxesDimensions) } ?: return
- if (dragon.state == WitherDragonState.DEAD) return
-
- dragon.state = WitherDragonState.ALIVE
- dragon.timeToSpawn = 100
- dragon.timesSpawned += 1
- dragon.entity = entity
- dragon.spawnedTime = System.currentTimeMillis()
- dragon.isSprayed = false
-
- if (sendArrowHit && WitherDragons.enabled) arrowSpawn(dragon)
- if (resetOnDragons && WitherDragons.enabled) onDragonSpawn()
- if (sendSpawned && WitherDragons.enabled) {
- val numberSuffix = when (dragon.timesSpawned) {
- 1 -> "st"
- 2 -> "nd"
- 3 -> "rd"
- else -> "th"
- }
- modMessage("§${dragon.colorCode}${dragon.name} §fdragon spawned. This is the §${dragon.colorCode}${dragon.timesSpawned}${numberSuffix}§f time it has spawned.")
- }
+ fun dragonUpdate(packet: S1CPacketEntityMetadata) {
+ val dragon = WitherDragonsEnum.entries.find { it.entityId == packet.entityId } ?: return
+ if (dragon.entity == null) return dragon.updateEntity(packet.entityId)
+ val health = packet.func_149376_c().find { it.dataValueId == 6 }?.`object` as? Float ?: return
+ if (health > 0 || dragon.state == WitherDragonState.DEAD) return
+ dragon.setDead()
}
- fun dragonLeaveWorld(event: LivingDeathEvent) {
- val entity = event.entity as? EntityDragon ?: return
- val dragon = WitherDragonsEnum.entries.find { it.entity?.entityId == entity.entityId } ?: return
- dragon.state = WitherDragonState.DEAD
- lastDragonDeath = dragon
-
- if (sendTime && WitherDragons.enabled)
- dragonPBs.time(dragon.ordinal, entity.ticksExisted / 20.0, "s§7!", "§${dragon.colorCode}${dragon.name} §7was alive for §6", addPBString = true, addOldPBString = true)
-
- if (sendArrowHit && WitherDragons.enabled) arrowDeath(dragon)
+ fun dragonSpawn(packet: S0FPacketSpawnMob) {
+ val dragon = WitherDragonsEnum.entries
+ .find { isVecInXZ(Vec3(packet.x / 32.0, packet.y / 32.0, packet.z / 32.0), it.boxesDimensions) }
+ ?.takeIf { it.state != WitherDragonState.SPAWNING } ?: return | Put the takeIf inside the find statement |
Odin | github_2023 | others | 123 | odtheking | freebonsai | @@ -14,55 +11,36 @@ import me.odinmain.features.impl.floor7.WitherDragons.sendTime
import me.odinmain.features.impl.skyblock.ArrowHit.onDragonSpawn
import me.odinmain.features.impl.skyblock.ArrowHit.resetOnDragons
import me.odinmain.utils.isVecInXZ
+import me.odinmain.utils.skyblock.PlayerUtils
import me.odinmain.utils.skyblock.modMessage
import net.minecraft.entity.boss.EntityDragon
import net.minecraft.entity.item.EntityArmorStand
import net.minecraft.init.Blocks
import net.minecraft.item.Item
import net.minecraft.network.play.server.S04PacketEntityEquipment
+import net.minecraft.network.play.server.S0FPacketSpawnMob
+import net.minecraft.network.play.server.S1CPacketEntityMetadata
+import net.minecraft.util.Vec3
import net.minecraftforge.event.entity.EntityJoinWorldEvent
-import net.minecraftforge.event.entity.living.LivingDeathEvent
object DragonCheck {
var lastDragonDeath: WitherDragonsEnum = WitherDragonsEnum.None
- var dragonEntityList = emptyList<EntityDragon>()
+ val dragonEntityList = mutableListOf<EntityDragon>()
- fun dragonJoinWorld(event: EntityJoinWorldEvent) {
- val entity = event.entity as? EntityDragon ?: return
- val dragon = WitherDragonsEnum.entries.find { isVecInXZ(entity.positionVector, it.boxesDimensions) } ?: return
- if (dragon.state == WitherDragonState.DEAD) return
-
- dragon.state = WitherDragonState.ALIVE
- dragon.timeToSpawn = 100
- dragon.timesSpawned += 1
- dragon.entity = entity
- dragon.spawnedTime = System.currentTimeMillis()
- dragon.isSprayed = false
-
- if (sendArrowHit && WitherDragons.enabled) arrowSpawn(dragon)
- if (resetOnDragons && WitherDragons.enabled) onDragonSpawn()
- if (sendSpawned && WitherDragons.enabled) {
- val numberSuffix = when (dragon.timesSpawned) {
- 1 -> "st"
- 2 -> "nd"
- 3 -> "rd"
- else -> "th"
- }
- modMessage("§${dragon.colorCode}${dragon.name} §fdragon spawned. This is the §${dragon.colorCode}${dragon.timesSpawned}${numberSuffix}§f time it has spawned.")
- }
+ fun dragonUpdate(packet: S1CPacketEntityMetadata) {
+ val dragon = WitherDragonsEnum.entries.find { it.entityId == packet.entityId } ?: return
+ if (dragon.entity == null) return dragon.updateEntity(packet.entityId)
+ val health = packet.func_149376_c().find { it.dataValueId == 6 }?.`object` as? Float ?: return
+ if (health > 0 || dragon.state == WitherDragonState.DEAD) return
+ dragon.setDead()
}
- fun dragonLeaveWorld(event: LivingDeathEvent) {
- val entity = event.entity as? EntityDragon ?: return
- val dragon = WitherDragonsEnum.entries.find { it.entity?.entityId == entity.entityId } ?: return
- dragon.state = WitherDragonState.DEAD
- lastDragonDeath = dragon
-
- if (sendTime && WitherDragons.enabled)
- dragonPBs.time(dragon.ordinal, entity.ticksExisted / 20.0, "s§7!", "§${dragon.colorCode}${dragon.name} §7was alive for §6", addPBString = true, addOldPBString = true)
-
- if (sendArrowHit && WitherDragons.enabled) arrowDeath(dragon)
+ fun dragonSpawn(packet: S0FPacketSpawnMob) {
+ val dragon = WitherDragonsEnum.entries
+ .find { isVecInXZ(Vec3(packet.x / 32.0, packet.y / 32.0, packet.z / 32.0), it.boxesDimensions) }
+ ?.takeIf { it.state != WitherDragonState.SPAWNING } ?: return
+ dragon.setAlive(packet.entityID) | Dragon does not need to be a variable since it is only used once, do the findinging of the entity and run setAlive directly on the result. |
Odin | github_2023 | others | 120 | odtheking | odtheking | @@ -40,6 +40,13 @@ val dungeonWaypointsCommand = commodore("dwp", "dungeonwaypoints") {
} ?: modMessage("Invalid type!")
}
+ literal("timer").runs { type: String -> | add color codes |
Odin | github_2023 | others | 120 | odtheking | odtheking | @@ -49,8 +56,10 @@ object SecretWaypoints {
val pos = Vec3(packet.x, packet.y, packet.z)
if (pos.distanceTo(etherpos) > 3) return
val room = DungeonUtils.currentFullRoom ?: return
- val vec = etherpos.subtractVec(x = room.clayPos.x, z = room.clayPos.z).rotateToNorth(room.room.rotation)
- getWaypoints(room).find { wp -> wp.toVec3().equal(vec) && wp.type == WaypointType.ETHERWARP }?.let {
+ val vec = room.getRelativeCoords(etherpos) | don't define variables if they are only used once |
Odin | github_2023 | others | 120 | odtheking | odtheking | @@ -61,15 +70,17 @@ object SecretWaypoints {
private fun clickSecret(pos: Vec3, distance: Int, block: IBlockState? = null) {
val room = DungeonUtils.currentFullRoom ?: return
- val vec = pos.subtractVec(x = room.clayPos.x, z = room.clayPos.z).rotateToNorth(room.room.rotation)
+ val vec = room.getRelativeCoords(pos)
+ val waypoints = getWaypoints(room) | why define it if its only used once |
Odin | github_2023 | others | 120 | odtheking | odtheking | @@ -86,4 +97,40 @@ object SecretWaypoints {
DungeonUtils.currentFullRoom?.let { setWaypoints(it) }
glList = -1
}
+
+ fun onPosUpdate(pos: Vec3) {
+ val room = DungeonUtils.currentFullRoom ?: return
+ val vec = room.getRelativeCoords(pos)
+
+ val waypoints = getWaypoints(room)
+ waypoints.find { wp -> wp.toVec3().addVec(y = 0.5).distanceTo(vec) <= 2 && wp.type == WaypointType.MOVE && !wp.clicked }?.let { wp ->
+ wp.timer?.let { if (handleTimer(wp, waypoints, room)) wp.clicked = true else return } ?: run { wp.clicked = true }
+ setWaypoints(room)
+ devMessage("clicked ${wp.toVec3()}")
+ glList = -1
+ }
+ }
+
+ private fun handleTimer(waypoint: DungeonWaypoint, waypoints: MutableList<DungeonWaypoint>, room: FullRoom): Boolean { | add color codes |
Odin | github_2023 | others | 120 | odtheking | odtheking | @@ -350,7 +350,7 @@ object RenderUtils {
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA)
for (box in boxes) {
- if (box.clicked) continue
+ if (box.clicked || box.color.alpha <= 0f) continue | use isTransparent |
Odin | github_2023 | others | 94 | odtheking | odtheking | @@ -0,0 +1,73 @@
+package me.odinclient.features.impl.skyblock | Merge with the TermAC module |
Odin | github_2023 | others | 94 | odtheking | odtheking | @@ -1,22 +1,22 @@
-pluginManagement {
| Don't touch this file |
Odin | github_2023 | others | 94 | odtheking | odtheking | @@ -0,0 +1,73 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinclient.utils.skyblock.PlayerUtils.leftClick
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.DropdownSetting
+import me.odinmain.features.settings.impl.KeybindSetting
+import me.odinmain.features.settings.impl.Keybinding
+import me.odinmain.features.settings.impl.NumberSetting
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import org.lwjgl.input.Keyboard
+
+object AutoClicker : Module(
+ name = "Auto Clicker",
+ description = "Automatically clicks for you.",
+ category = Category.SKYBLOCK
+) {
+ private val leftclickcps: Boolean by DropdownSetting("Left Click Dropdown", false)
+ private val leftcps: Double by NumberSetting("Clicks Per Second", 5.0, 3.0, 15.0, .5, false, "The amount of clicks per second to perform.").withDependency { AutoClicker.leftclickcps }
+ private val leftkeybind: Keybinding by KeybindSetting("Auto Clicker Left Keybind", Keyboard.KEY_NONE, "Starts and stops the Auto Clicker for left clicks.").withDependency { AutoClicker.leftclickcps }
+ private val rightclickcps: Boolean by DropdownSetting("Right Click Dropdown", false)
+ private val rightcps: Double by NumberSetting("Clicks Per Second", 5.0, 3.0, 15.0, .5, false, "The amount of clicks per second to perform.").withDependency { AutoClicker.rightclickcps }
+ private val rightkeybind: Keybinding by KeybindSetting("Auto Clicker Right Keybind", Keyboard.KEY_NONE, "Starts and stops the Auto Clicker for right clicks.").withDependency { AutoClicker.rightclickcps }
+
+ private var nextLeftClick: Long = 0
+ private var nextRightClick: Long = 0
+
+ // Track previous key states and toggle state
+ private var wasLeftKeyDown = false
+ private var wasRightKeyDown = false
+ private var isLeftClicking = false
+ private var isRightClicking = false
+
+ @SubscribeEvent
+ fun onRenderWorldLast(event: RenderWorldLastEvent) {
+ val nowMillis = System.currentTimeMillis()
+
+ // Handle left click toggle
+ if (leftclickcps) {
+ if (leftkeybind.isDown() && !wasLeftKeyDown) {
+ // Toggle auto clicking
+ isLeftClicking = !isLeftClicking
+ nextLeftClick = if (isLeftClicking) nowMillis else Long.MAX_VALUE | Use Odin's left click and right click functions instead |
Odin | github_2023 | others | 119 | odtheking | odtheking | @@ -90,8 +92,9 @@ object MapInfo : Module(
init {
execute(250) {
- if (DungeonUtils.score < 300 || shownTitle || !scoreTitle || !DungeonUtils.inDungeons) return@execute
- PlayerUtils.alert(scoreText.replace("&", "§"))
+ if (DungeonUtils.score < 300 || shownTitle || (!scoreTitle && !printWhenScore) || !DungeonUtils.inDungeons) return@execute
+ if (scoreTitle) PlayerUtils.alert(scoreText.replace("&", "§"))
+ if (printWhenScore) modMessage("§a${DungeonUtils.score} §bscore reached in §c${DungeonUtils.dungeonTime}.") | i dont think i like these color codes |
Odin | github_2023 | others | 105 | odtheking | odtheking | @@ -56,5 +56,6 @@
"Broodfather",
"Night Spider"
],
- "Which of these monsters only spawns at night?": ["Zombie Villager", "Ghast"]
+ "Which of these monsters only spawns at night?": ["Zombie Villager", "Ghast"],
+ "What is the name of the vendor in the Hub who sells stained": ["Wool Weaver"] | Seems like the entry is duped just make sure to remove the redundent one |
Odin | github_2023 | others | 103 | odtheking | odtheking | @@ -117,4 +118,6 @@ fun openRandomTerminal(ping: Long = 0L, const: Long = 0L) {
TerminalTypes.MELODY -> {}
TerminalTypes.NONE -> {}
}
-}
\ No newline at end of file
+}
+
+fun isTermSimOpen() = OdinMain.mc.currentScreen is TermSimGui | Mod code style wise we don't make functions for a single check please implement the check instead of a function for it
Also make sure to import me.odinmain.OdinMain.mc instead of me.odinmain.OdinMain |
Odin | github_2023 | others | 62 | odtheking | xKiian | @@ -0,0 +1,107 @@
+package me.odinmain.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.events.impl.PacketSentEvent
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.ListSetting
+import me.odinmain.utils.isVecInXZ
+import me.odinmain.utils.skyblock.LocationUtils
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.modMessage
+import me.odinmain.utils.skyblock.partyMessage
+import net.minecraft.network.play.client.C03PacketPlayer.C04PacketPlayerPosition
+import net.minecraft.util.AxisAlignedBB
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import java.util.*
+import kotlin.concurrent.schedule
+
+object PosMessages : Module(
+ name = "Positional Messages",
+ category = Category.DUNGEON,
+ description = "Sends a message when you're near a certain position. /posmsg"
+) {
+ private val onlyDungeons: Boolean by BooleanSetting("Only in Dungeons", true, description = "Only sends messages when you're in a dungeon.")
+
+ data class PosMessage(val x: Double, val y: Double, val z: Double, val x2: Double?, val y2: Double?, val z2: Double?, val delay: Long, val distance: Double?, val message: String)
+ val posMessageStrings: MutableList<String> by ListSetting("Pos Messages Strings", mutableListOf())
+ private val sentMessages = mutableMapOf<PosMessage, Boolean>()
+
+ val parsedStrings: MutableList<PosMessage> = mutableListOf()
+
+ @SubscribeEvent
+ fun posMessageSend(event: PacketSentEvent) {
+ if (event.packet !is C04PacketPlayerPosition || (onlyDungeons && !DungeonUtils.inDungeons)) return
+ parsedStrings.forEach { message ->
+ message.x2?.let { handleInString(message) } ?: handleAtString(message)
+ }
+ }
+
+ var parsed = false
+
+ init {
+ onWorldLoad {
+ if (parsed) return@onWorldLoad
+ posMessageStrings.forEach { findParser(it, true) }
+ parsed = true
+ }
+ }
+
+ private val atRegex = Regex("x: (.*), y: (.*), z: (.*), delay: (.*), distance: (.*), message: \"(.*)\"")
+
+ fun findParser(posMessageString: String, addToList: Boolean): PosMessage? {
+ val message = if (posMessageString.matches(atRegex)) parseAtString(posMessageString) else parseInString(posMessageString)
+ if (addToList) message?.let { parsedStrings.add(it) }
+ return message
+ }
+
+ private fun handleAtString(posMessage: PosMessage) {
+ val msgSent = sentMessages.getOrDefault(posMessage, false)
+ if (mc.thePlayer != null && mc.thePlayer.getDistance(posMessage.x, posMessage.y, posMessage.z) <= (posMessage.distance ?: return)) {
+ if (!msgSent) Timer().schedule(posMessage.delay) {
+ if (mc.thePlayer.getDistance(posMessage.x, posMessage.y, posMessage.z) <= posMessage.distance)
+ partyMessage(posMessage.message)
+ }
+ sentMessages[posMessage] = true
+ } else sentMessages[posMessage] = false
+ }
+
+ private fun handleInString(posMessage: PosMessage) {
+ val msgSent = sentMessages.getOrDefault(posMessage, false)
+ if (mc.thePlayer != null && isVecInXZ(mc.thePlayer.positionVector, AxisAlignedBB(posMessage.x, posMessage.y, posMessage.z, posMessage.x2 ?: return, posMessage.y2 ?: return, posMessage.z2 ?: return))) {
+ if (!msgSent) Timer().schedule(posMessage.delay) {
+ if (isVecInXZ(mc.thePlayer.positionVector, AxisAlignedBB(posMessage.x, posMessage.y, posMessage.z, posMessage.x2, posMessage.y2, posMessage.z2))) { | Why are you checking twice? |
Odin | github_2023 | others | 98 | odtheking | odtheking | @@ -96,7 +98,10 @@ class Dungeon(val floor: Floor?) {
val text = packet.prefix.plus(packet.suffix)
val cleared = Regex("^Cleared: §[c6a](\\d+)% §8(?:§8)?\\(\\d+\\)$").find(text)
- if (cleared != null) dungeonStats.percentCleared = cleared.groupValues[1].toInt()
+ if (cleared != null) { | Use ?.let instead |
Odin | github_2023 | others | 91 | odtheking | freebonsai | @@ -41,35 +43,66 @@ object TerminalSounds : Module(
@SubscribeEvent
fun onPacket(event: PacketReceivedEvent){
with(event.packet) {
+ //if (this is S29PacketSoundEffect) modMessage("$soundName, $volume, $pitch")
if (
- this !is S29PacketSoundEffect ||
- currentTerm == TerminalTypes.NONE ||
- customSound == "note.pling" ||
- soundName != "note.pling" ||
- volume != 8f ||
- pitch != 4.047619f ||
- !clickSounds
- ) return
- playTerminalSound()
- event.isCanceled = true
+ this is S29PacketSoundEffect &&
+ soundName == "note.pling" &&
+ volume == 8f &&
+ //pitch == 1.8888888f &&
+ pitch == 4.047619f &&
+ shouldReplaceSounds
+ ) event.isCanceled = true
}
}
+ @SubscribeEvent
+ fun onSlotClick(event: GuiEvent.GuiMouseClickEvent) {
+ if (!shouldReplaceSounds) return
+ val slot = (event.gui as? GuiChest)?.slotUnderMouse?.slotIndex ?: return
+ clickSlot(slot)
+ }
+
+ @SubscribeEvent
+ fun onCustomSlotClick(event: GuiEvent.CustomTermGuiClick) {
+ if (!shouldReplaceSounds) return
+ clickSlot(event.slot)
+ }
+
@SubscribeEvent
fun onTermComplete(event: TerminalSolvedEvent) {
- if (event.type == TerminalTypes.NONE || mc.currentScreen is TermSimGui || event.playerName != mc.thePlayer?.name || !completeSounds) return
- playCompleteSound()
+ if (shouldReplaceSounds && event.playerName != mc.thePlayer?.name || (!completeSounds && !clickSounds)) mc.thePlayer.playSound("note.pling", 8f, 4f)
+ else if (shouldReplaceSounds && completeSounds && !clickSounds) playCompleteSound()
+ }
+
+ init {
+ onMessage("The gate has been destroyed!", false, { enabled && shouldReplaceSounds }) { mc.thePlayer.playSound("note.pling", 8f, 4f) }
+
+ onMessage("The Core entrance is opening!", false, { enabled && shouldReplaceSounds }) { mc.thePlayer.playSound("note.pling", 8f, 4f) }
+ }
+
+ private fun clickSlot(slot: Int) {
+ if (
+ (currentTerm != TerminalTypes.ORDER && slot !in TerminalSolver.solution) ||
+ (currentTerm == TerminalTypes.ORDER && slot != TerminalSolver.solution.first()) ||
+ (currentTerm == TerminalTypes.MELODY && slot !in arrayOf(43, 34, 25, 16)) | uh make the (currentTerm == TerminalTypes.MELODY && slot == 43) check here instead? |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -69,6 +70,22 @@ val ItemStack?.isShortbow: Boolean
return this?.lore?.any { it.contains("Shortbow: Instantly shoots!") } == true
}
+/**
+ * Returns if an item is a fishing rod
+ */
+val ItemStack?.isFishingRod: Boolean
+ get() {
+ return this?.lore?.any { it.contains("FISHING ROD") } == true
+ }
+
+/**
+ * Returns if an item is Spirit leaps or an Infinileap
+ */
+val ItemStack?.isLeap: Boolean
+ get() {
+ return this?.unformattedName?.noControlCodes?.equalsOneOf("Infinileap", "Spirit Leap") ?: false | use itemid |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -0,0 +1,191 @@
+package me.odin.features.impl.floor7.p3
+
+import me.odinmain.events.impl.BlockChangeEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.*
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.Renderer
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.dungeon.M7Phases
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.init.Blocks
+import net.minecraft.util.AxisAlignedBB
+import net.minecraft.util.BlockPos
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+import org.lwjgl.input.Keyboard
+
+object ArrowsDevice : Module(
+ name = "Arrows Device",
+ description = "Solver for the Sharp Shooter puzzle in floor 7.",
+ category = Category.FLOOR7,
+) {
+ private val solver: Boolean by BooleanSetting("Solver")
+ private val markedPositionColor: Color by ColorSetting("Marked Position", Color.RED, description = "Color of the marked position.").withDependency { solver }
+ private val targetPositionColor: Color by ColorSetting("Target Position", Color.GREEN, description = "Color of the target position.").withDependency { solver }
+ private val alertOnDeviceComplete: Boolean by BooleanSetting("Device complete alert", default = true, description = "Send an alert when device is complete")
+ private val resetKey: Keybinding by KeybindSetting("Reset", Keyboard.KEY_NONE, description = "Resets the solver.").onPress {
+ reset()
+ }.withDependency { solver }
+ private val depthCheck: Boolean by BooleanSetting("Depth check", true, description = "Marked positions show through walls.").withDependency { solver }
+ private val reset: () -> Unit by ActionSetting("Reset") {
+ markedPositions.clear()
+ }.withDependency { solver }
+
+ private val markedPositions = mutableSetOf<BlockPos>()
+ private var targetPosition: BlockPos? = null
+
+ private var isDeviceComplete = false
+
+ // ArmorStand showing the status of the device
+ private var activeArmorStand: EntityArmorStand? = null
+
+ // Number of server ticks since the last target disappeared, or null if there is a target
+ private var serverTicksSinceLastTargetDisappeared: Int? = null;
+
+ init {
+ onMessage(Regex("^[a-zA-Z0-9_]{3,} completed a device! \\([1-7]/7\\)"), { enabled && isPlayerInRoom() }) {
+ onComplete()
+ }
+
+ onMessage(Regex("^ ☠ You died and became a ghost\\.$"), { enabled && isPlayerOnStand() }) {
+ // Prevent the tick count from continuing and registering a false positive
+ // This does mean we could get a false negative but since the player is already
+ // dead knowing if the device is complete has less importance (no leaping)
+ serverTicksSinceLastTargetDisappeared = 11
+ }
+
+ execute(1000) {
+ if(DungeonUtils.getPhase() != M7Phases.P3) return@execute
+
+ // Cast is safe since we won't return an entity that isn't an armor stand
+ activeArmorStand = mc.theWorld?.loadedEntityList?.find {
+ it is EntityArmorStand && it.name.containsOneOf(INACTIVE_DEVICE_STRING, ACTIVE_DEVICE_STRING) && it.distanceSquaredTo(
+ standPosition.toVec3()) <= 4.0
+ } as EntityArmorStand?
+ }
+
+ onWorldLoad {
+ reset()
+ // Reset is called when leaving the device room, but device remains complete across an entire run, so this doesn't belong in reset
+ isDeviceComplete = false
+ }
+ }
+
+ private fun isPlayerOnStand(): Boolean {
+ return (mc.thePlayer?.distanceSquaredTo(standPosition.toVec3()) ?: Double.MAX_VALUE) <= 1.0
+ }
+
+ private fun isPlayerInRoom(): Boolean {
+ return mc.thePlayer?.let { roomBoundingBox.isVecInside(it.positionVector) } ?: false
+ }
+
+ // There are 3 detection methods for device completion:
+ // - Message: If the '... completed a device! (1/7)' message is sent, this is usually the fastest way to detect,
+ // but doesn't always work (sometimes the message simply doesn't get sent, especially in i4)
+ // - ArmorStand: If the 'Device Active' text is displayed, this always works but is the slowest
+ // - Ticks: If the next emerald block doesn't appear for 10 (or more) server ticks, this is faster than the checking
+ // for the text most of the time (but not always) also can fail if the player leaves the device before those 10
+ // ticks are up
+ // We use all three here since we want to detect as soon as possible (since we might die if we wait too long).
+ private fun onComplete() {
+ if(isDeviceComplete) return
+
+ isDeviceComplete = true
+
+ if(alertOnDeviceComplete) {
+ modMessage("Sharp shooter device complete")
+ PlayerUtils.alert("Device Complete", color = Color.GREEN)
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(tickEvent: ClientTickEvent) {
+ if(!isPlayerInRoom()) {
+ reset()
+ return
+ }
+
+ if(!isDeviceComplete && activeArmorStand?.name == ACTIVE_DEVICE_STRING) { | formatting |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -0,0 +1,191 @@
+package me.odin.features.impl.floor7.p3
+
+import me.odinmain.events.impl.BlockChangeEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.*
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.Renderer
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.dungeon.M7Phases
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.init.Blocks
+import net.minecraft.util.AxisAlignedBB
+import net.minecraft.util.BlockPos
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+import org.lwjgl.input.Keyboard
+
+object ArrowsDevice : Module(
+ name = "Arrows Device",
+ description = "Solver for the Sharp Shooter puzzle in floor 7.",
+ category = Category.FLOOR7,
+) {
+ private val solver: Boolean by BooleanSetting("Solver")
+ private val markedPositionColor: Color by ColorSetting("Marked Position", Color.RED, description = "Color of the marked position.").withDependency { solver }
+ private val targetPositionColor: Color by ColorSetting("Target Position", Color.GREEN, description = "Color of the target position.").withDependency { solver }
+ private val alertOnDeviceComplete: Boolean by BooleanSetting("Device complete alert", default = true, description = "Send an alert when device is complete")
+ private val resetKey: Keybinding by KeybindSetting("Reset", Keyboard.KEY_NONE, description = "Resets the solver.").onPress {
+ reset()
+ }.withDependency { solver }
+ private val depthCheck: Boolean by BooleanSetting("Depth check", true, description = "Marked positions show through walls.").withDependency { solver }
+ private val reset: () -> Unit by ActionSetting("Reset") {
+ markedPositions.clear()
+ }.withDependency { solver }
+
+ private val markedPositions = mutableSetOf<BlockPos>()
+ private var targetPosition: BlockPos? = null
+
+ private var isDeviceComplete = false
+
+ // ArmorStand showing the status of the device
+ private var activeArmorStand: EntityArmorStand? = null
+
+ // Number of server ticks since the last target disappeared, or null if there is a target
+ private var serverTicksSinceLastTargetDisappeared: Int? = null;
+
+ init {
+ onMessage(Regex("^[a-zA-Z0-9_]{3,} completed a device! \\([1-7]/7\\)"), { enabled && isPlayerInRoom() }) {
+ onComplete()
+ }
+
+ onMessage(Regex("^ ☠ You died and became a ghost\\.$"), { enabled && isPlayerOnStand() }) {
+ // Prevent the tick count from continuing and registering a false positive
+ // This does mean we could get a false negative but since the player is already
+ // dead knowing if the device is complete has less importance (no leaping)
+ serverTicksSinceLastTargetDisappeared = 11
+ }
+
+ execute(1000) {
+ if(DungeonUtils.getPhase() != M7Phases.P3) return@execute
+
+ // Cast is safe since we won't return an entity that isn't an armor stand
+ activeArmorStand = mc.theWorld?.loadedEntityList?.find {
+ it is EntityArmorStand && it.name.containsOneOf(INACTIVE_DEVICE_STRING, ACTIVE_DEVICE_STRING) && it.distanceSquaredTo(
+ standPosition.toVec3()) <= 4.0
+ } as EntityArmorStand?
+ }
+
+ onWorldLoad {
+ reset()
+ // Reset is called when leaving the device room, but device remains complete across an entire run, so this doesn't belong in reset
+ isDeviceComplete = false
+ }
+ }
+
+ private fun isPlayerOnStand(): Boolean {
+ return (mc.thePlayer?.distanceSquaredTo(standPosition.toVec3()) ?: Double.MAX_VALUE) <= 1.0
+ }
+
+ private fun isPlayerInRoom(): Boolean { | make both of these val getters, just cleaner |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -0,0 +1,417 @@
+package me.odinclient.features.impl.floor7.p3
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.events.impl.BlockChangeEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.*
+import me.odinmain.utils.clock.Clock
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.Renderer
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.skyblock.dungeon.DungeonClass
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.dungeon.M7Phases
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.util.AxisAlignedBB
+import net.minecraft.util.BlockPos
+import net.minecraft.util.Vec3
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+import org.lwjgl.input.Keyboard
+
+object ArrowsDevice : Module(
+ name = "Arrows Device",
+ description = "Different features for the Sharp Shooter puzzle in floor 7.",
+ category = Category.FLOOR7,
+ tag = TagType.RISKY,
+) {
+ private val solver: Boolean by BooleanSetting("Solver")
+ private val markedPositionColor: Color by ColorSetting("Marked Position", Color.RED, description = "Color of the marked position.").withDependency { solver }
+ private val targetPositionColor: Color by ColorSetting("Target Position", Color.GREEN, description = "Color of the target position.").withDependency { solver }
+ private val alertOnDeviceComplete: Boolean by BooleanSetting("Device complete alert", default = true, description = "Send an alert when device is complete")
+ private val resetKey: Keybinding by KeybindSetting("Reset", Keyboard.KEY_NONE, description = "Resets the solver.").onPress {
+ reset()
+ }.withDependency { solver }
+ private val depthCheck: Boolean by BooleanSetting("Depth check", true, description = "Marked positions show through walls.").withDependency { solver }
+ private val reset: () -> Unit by ActionSetting("Reset") {
+ markedPositions.clear()
+ autoState = AutoState.Stopped
+ actionQueue.clear()
+ }.withDependency { solver }
+ private val auto: Boolean by BooleanSetting("Auto", description = "Automatically complete device")
+ private val autoPhoenix: Boolean by BooleanSetting("Auto phoenix", default = true, description = "Automatically swap to phoenix pet using cast rod pet rules, must be set up correctly").withDependency { auto }
+ private val autoLeap: Boolean by BooleanSetting("Auto leap", default = true, description = "Automatically leap once device is done").withDependency { auto }
+ private val autoLeapClass: Int by SelectorSetting("Leap to", defaultSelected = "Archer", arrayListOf("Archer", "Mage", "Berserk", "Healer", "Tank"), description = "Who to leap to").withDependency { autoLeap && auto }
+ private val autoLeapOnlyPre: Boolean by BooleanSetting("Only leap on pre", default = true, description = "Only auto leap when doing i4").withDependency { autoLeap && auto }
+ private val delay: Long by NumberSetting("Delay", 150L, 80, 300, description = "Delay between actions").withDependency { auto }
+ private val aimingTime: Long by NumberSetting("Aiming duration", 100L, 80, 200, description = "Time taken to aim at a target").withDependency { auto }
+
+ private val markedPositions = mutableSetOf<BlockPos>()
+ private var targetPosition: BlockPos? = null
+
+ private var autoState = AutoState.Stopped
+ private var isPhoenixSwapping = false
+ private var isDeviceComplete = false
+ private var bowSlot = 0
+
+ // ArmorStand showing the status of the device
+ private var activeArmorStand: EntityArmorStand? = null
+
+ // Clock used for action delay (mostly for phoenix swapping and leap)
+ private val clock = Clock(delay)
+ private val actionQueue = ArrayDeque<() -> Unit>()
+
+ // Number of server ticks since the last target disappeared, or null if there is a target
+ private var serverTicksSinceLastTargetDisappeared: Int? = null;
+ | do all the same stuff as i commented in legit version |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -0,0 +1,417 @@
+package me.odinclient.features.impl.floor7.p3
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.events.impl.BlockChangeEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.*
+import me.odinmain.utils.clock.Clock
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.Renderer
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.skyblock.dungeon.DungeonClass
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.dungeon.M7Phases
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.util.AxisAlignedBB
+import net.minecraft.util.BlockPos
+import net.minecraft.util.Vec3
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+import org.lwjgl.input.Keyboard
+
+object ArrowsDevice : Module(
+ name = "Arrows Device",
+ description = "Different features for the Sharp Shooter puzzle in floor 7.",
+ category = Category.FLOOR7,
+ tag = TagType.RISKY,
+) {
+ private val solver: Boolean by BooleanSetting("Solver")
+ private val markedPositionColor: Color by ColorSetting("Marked Position", Color.RED, description = "Color of the marked position.").withDependency { solver }
+ private val targetPositionColor: Color by ColorSetting("Target Position", Color.GREEN, description = "Color of the target position.").withDependency { solver }
+ private val alertOnDeviceComplete: Boolean by BooleanSetting("Device complete alert", default = true, description = "Send an alert when device is complete")
+ private val resetKey: Keybinding by KeybindSetting("Reset", Keyboard.KEY_NONE, description = "Resets the solver.").onPress {
+ reset()
+ }.withDependency { solver }
+ private val depthCheck: Boolean by BooleanSetting("Depth check", true, description = "Marked positions show through walls.").withDependency { solver }
+ private val reset: () -> Unit by ActionSetting("Reset") {
+ markedPositions.clear()
+ autoState = AutoState.Stopped
+ actionQueue.clear()
+ }.withDependency { solver }
+ private val auto: Boolean by BooleanSetting("Auto", description = "Automatically complete device")
+ private val autoPhoenix: Boolean by BooleanSetting("Auto phoenix", default = true, description = "Automatically swap to phoenix pet using cast rod pet rules, must be set up correctly").withDependency { auto }
+ private val autoLeap: Boolean by BooleanSetting("Auto leap", default = true, description = "Automatically leap once device is done").withDependency { auto }
+ private val autoLeapClass: Int by SelectorSetting("Leap to", defaultSelected = "Archer", arrayListOf("Archer", "Mage", "Berserk", "Healer", "Tank"), description = "Who to leap to").withDependency { autoLeap && auto }
+ private val autoLeapOnlyPre: Boolean by BooleanSetting("Only leap on pre", default = true, description = "Only auto leap when doing i4").withDependency { autoLeap && auto }
+ private val delay: Long by NumberSetting("Delay", 150L, 80, 300, description = "Delay between actions").withDependency { auto }
+ private val aimingTime: Long by NumberSetting("Aiming duration", 100L, 80, 200, description = "Time taken to aim at a target").withDependency { auto }
+
+ private val markedPositions = mutableSetOf<BlockPos>()
+ private var targetPosition: BlockPos? = null
+
+ private var autoState = AutoState.Stopped
+ private var isPhoenixSwapping = false
+ private var isDeviceComplete = false
+ private var bowSlot = 0
+
+ // ArmorStand showing the status of the device
+ private var activeArmorStand: EntityArmorStand? = null
+
+ // Clock used for action delay (mostly for phoenix swapping and leap)
+ private val clock = Clock(delay)
+ private val actionQueue = ArrayDeque<() -> Unit>()
+
+ // Number of server ticks since the last target disappeared, or null if there is a target
+ private var serverTicksSinceLastTargetDisappeared: Int? = null;
+
+ init {
+ onMessage(Regex("^Your (?:. )?Bonzo's Mask saved your life!$"), { enabled && auto && autoPhoenix && isPlayerOnStand() }) {
+ phoenixSwap()
+ }
+
+ onMessage(Regex("^[a-zA-Z0-9_]{3,} completed a device! \\([1-7]/7\\)"), { enabled && isPlayerInRoom() }) {
+ onComplete()
+ }
+
+ onMessage(Regex("^ ☠ You died and became a ghost\\.$"), { enabled && isPlayerOnStand() }) {
+ // Died while on device
+ autoState = AutoState.Stopped
+ actionQueue.clear()
+ // Prevent the tick count from continuing and registering a false positive
+ // This does mean we could get a false negative but since the player is already
+ // dead knowing if the device is complete has less importance (no leaping)
+ serverTicksSinceLastTargetDisappeared = 11
+ }
+
+ execute(1000) {
+ if(DungeonUtils.getPhase() != M7Phases.P3) return@execute
+
+ // Cast is safe since we won't return an entity that isn't an armor stand
+ activeArmorStand = mc.theWorld?.loadedEntityList?.find {
+ it is EntityArmorStand && it.name.containsOneOf(INACTIVE_DEVICE_STRING, ACTIVE_DEVICE_STRING) && it.distanceSquaredTo(
+ standPosition.toVec3()) <= 4.0
+ } as EntityArmorStand?
+ }
+
+ onWorldLoad {
+ reset()
+ // Reset is called when leaving the device room, but device remains complete across an entire run, so this doesn't belong in reset
+ isDeviceComplete = false
+ }
+ }
+
+ private fun isDeviceRoomOpen(): Boolean {
+ val block = mc.theWorld.getBlockState(lastGateBlock)
+ return block == Blocks.air.defaultState
+ }
+
+ private fun isPlayerOnStand(): Boolean {
+ return (mc.thePlayer?.distanceSquaredTo(standPosition.toVec3()) ?: Double.MAX_VALUE) <= 1.0
+ }
+
+ private fun isPlayerInRoom(): Boolean {
+ return mc.thePlayer?.let { roomBoundingBox.isVecInside(it.positionVector) } ?: false
+ }
+
+ private fun holdClick() {
+ if(!mc.gameSettings.keyBindUseItem.isPressed) {
+ KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.keyCode, true)
+ }
+ }
+
+ private fun releaseClick() {
+ if(mc.gameSettings.keyBindUseItem.isPressed) {
+ KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.keyCode, false)
+ }
+ }
+
+ private fun setCurrentSlot(slot: Int) {
+ mc.thePlayer.inventory.currentItem = slot
+ }
+
+ private fun holdBow() {
+ if((mc.thePlayer?.inventory?.currentItem ?: -1) != bowSlot) {
+ mc.thePlayer.inventory.currentItem = bowSlot
+ }
+ }
+
+ private fun phoenixSwap() {
+ val rodSlot = mc.thePlayer?.inventory?.mainInventory?.indexOfFirst { it.isFishingRod } ?: -1;
+
+ if (rodSlot < 0 || rodSlot >= 9) {
+ modMessage("Couldn't find rod for phoenix swap")
+ return
+ }
+
+ releaseClick()
+
+ isPhoenixSwapping = true
+
+ modMessage("Phoenix swapping")
+
+ clock.update()
+
+ actionQueue.addAll(listOf(
+ {
+ // I would use swapToIndex, but for some reason it doesn't work, so this is it
+ setCurrentSlot(rodSlot)
+ },
+ {
+ rightClick()
+ },
+ {
+ setCurrentSlot(bowSlot)
+ isPhoenixSwapping = false
+ }
+ ))
+ }
+
+ private fun leap() {
+ val leapSlot = mc.thePlayer?.inventory?.mainInventory?.indexOfFirst { it.isLeap } ?: -1
+
+ if (leapSlot < 0 || leapSlot >= 9) {
+ modMessage("Couldn't find leaps for auto leap")
+ return
+ }
+
+ if (DungeonUtils.leapTeammates.isEmpty()) {
+ modMessage("Can't leap, there are no teammates")
+ return
+ }
+
+ modMessage("Leaping")
+
+ autoState = AutoState.Leaping
+
+ clock.update()
+
+ actionQueue.addAll(listOf(
+ {
+ setCurrentSlot(leapSlot)
+ },
+ {
+ autoState = AutoState.WaitingOnLeapingGui
+ rightClick()
+ }
+ ))
+ }
+
+ private fun aimAtTarget() {
+ targetPosition?.let {
+
+ if(isPhoenixSwapping) {
+ // We are busy with swapping to phoenix, so wait until that's done
+ actionQueue.add(::aimAtTarget)
+ return
+ }
+
+ val index = positions.indexOf(it)
+ // Position of the target in the grid
+ val x = index % 3
+ val y = index / 3
+
+ // Choose a correct target to hit as many blocks as possible
+ val target = Vec3(
+ if (x == 0 || (x == 1 && markedPositions.contains(positions[x + 1 + y * 3]))) { 67.5 } else { 65.5 },
+ 131.3 - 2 * y,
+ 50.0
+ )
+
+ holdBow()
+ holdClick()
+ val (_, yaw, pitch) = getDirectionToVec3(target)
+ smoothRotateTo(yaw, pitch, aimingTime) {
+ autoState = AutoState.Shooting
+ holdBow()
+ }
+ }
+ }
+
+ // There are 3 detection methods for device completion:
+ // - Message: If the '... completed a device! (1/7)' message is sent, this is usually the fastest way to detect,
+ // but doesn't always work (sometimes the message simply doesn't get sent, especially in i4)
+ // - ArmorStand: If the 'Device Active' text is displayed, this always works but is the slowest
+ // - Ticks: If the next emerald block doesn't appear for 10 (or more) server ticks, this is faster than the checking
+ // for the text most of the time (but not always) also can fail if the player leaves the device before those 10
+ // ticks are up
+ // We use all three here since we want to detect as soon as possible (since we might die if we wait too long).
+ private fun onComplete() {
+ if(isDeviceComplete) return
+
+ isDeviceComplete = true
+ releaseClick()
+
+ if(alertOnDeviceComplete) {
+ modMessage("Sharp shooter device complete")
+ PlayerUtils.alert("Device Complete", color = Color.GREEN)
+ }
+
+ autoState = AutoState.Stopped
+
+ if (auto && autoLeap && (!autoLeapOnlyPre || !isDeviceRoomOpen())) {
+ leap()
+ }
+ }
+
+ @SubscribeEvent
+ fun guiOpen(event: GuiOpenEvent) {
+ if (autoState != AutoState.WaitingOnLeapingGui) return
+ val chest = (event.gui as? GuiChest)?.inventorySlots ?: return
+ if (chest !is ContainerChest || chest.name != "Spirit Leap" || DungeonUtils.leapTeammates.isEmpty()) return
+
+ val leapTo = DungeonUtils.leapTeammates.firstOrNull { it.clazz == classes[autoLeapClass] } ?: DungeonUtils.leapTeammates.first()
+
+ clock.update()
+
+ actionQueue.add {
+ getItemIndexInContainerChest(chest, leapTo.name, 11..16)?.let {
+ PlayerUtils.windowClick(it, PlayerUtils.ClickType.Middle, instant = false)
+ }
+ autoState = AutoState.Stopped
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(tickEvent: ClientTickEvent) {
+ if(!isPlayerInRoom()) {
+ reset()
+ return
+ }
+
+ if(!isDeviceComplete && activeArmorStand?.name == ACTIVE_DEVICE_STRING) {
+ onComplete()
+ }
+
+ if (autoState != AutoState.Stopped) {
+ if (!isPlayerOnStand()) {
+ autoState = AutoState.Stopped
+ releaseClick()
+ return
+ }
+
+ if (autoState == AutoState.Shooting && !isPhoenixSwapping) {
+ holdClick()
+ }
+
+ if (clock.hasTimePassed(delay) && actionQueue.isNotEmpty()) {
+ actionQueue.removeFirst()()
+ clock.update()
+ }
+ }
+ }
+
+
+ @SubscribeEvent
+ fun onServerTick(event: RealServerTick) {
+ serverTicksSinceLastTargetDisappeared = serverTicksSinceLastTargetDisappeared?.let {
+ // There was no target last tick (or the count would be null)
+
+ if(targetPosition != null) {
+ // A target appeared
+ return@let null
+ } else if (it < 10) {
+ // No target yet, count the ticks
+ return@let it + 1
+ } else if (it == 10) {
+ // We reached 10 ticks, device is either done, or the player left the stand
+ if(isPlayerOnStand()) onComplete()
+ return@let 11
+ } else {
+ return@let 11
+ }
+ } ?: run {
+ // There was a target last tick (or one appeared this tick
+
+ // Check if target disappeared, set count accordingly
+ return@run if (targetPosition == null) 0 else null
+ }
+ }
+
+ @SubscribeEvent
+ fun onBlockChange(event: BlockChangeEvent) {
+ if (!DungeonUtils.inDungeons || DungeonUtils.getPhase() != M7Phases.P3 || !positions.contains(event.pos)) return
+
+ // Target was hit
+ if (event.old.block == Blocks.emerald_block && event.update.block == Blocks.stained_hardened_clay) {
+ markedPositions.add(event.pos)
+ // This condition should always be true but im never sure with Hypixel
+ if (targetPosition == event.pos) {
+ targetPosition = null
+
+ if(autoState != AutoState.Stopped) {
+ //releaseClick()
+ autoState = AutoState.Aiming
+ }
+ }
+ }
+
+ // New target appeared
+ if (event.old.block == Blocks.stained_hardened_clay && event.update.block == Blocks.emerald_block) {
+ // Can happen with resets
+ markedPositions.remove(event.pos)
+ targetPosition = event.pos
+
+ if (isPlayerOnStand() && auto) {
+ if (autoState == AutoState.Stopped) {
+ bowSlot = mc.thePlayer?.inventory?.mainInventory?.indexOfFirst { it.isShortbow } ?: -1;
+
+ if (bowSlot < 0 || bowSlot >= 9) {
+ modMessage("Couldn't find shortbow for auto sharp shooter")
+ return
+ }
+
+ modMessage("Starting sharp shooter")
+ }
+
+ autoState = AutoState.Aiming
+ aimAtTarget()
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorldLast(event: RenderWorldLastEvent) {
+ if (!DungeonUtils.inDungeons || DungeonUtils.getPhase() != M7Phases.P3 || !solver) return
+ markedPositions.forEach {
+ Renderer.drawBlock(it, markedPositionColor, depth = depthCheck)
+ }
+ targetPosition?.let {
+ Renderer.drawBlock(it, targetPositionColor, depth = depthCheck)
+ }
+ }
+
+ // This is order dependent
+ private val positions = listOf(
+ BlockPos(68, 130, 50), BlockPos(66, 130, 50), BlockPos(64, 130, 50),
+ BlockPos(68, 128, 50), BlockPos(66, 128, 50), BlockPos(64, 128, 50),
+ BlockPos(68, 126, 50), BlockPos(66, 126, 50), BlockPos(64, 126, 50)
+ )
+
+ // Position of the pressure plate for auto
+ private val standPosition = BlockPos(63.5, 127.0, 35.5)
+ private val roomBoundingBox = AxisAlignedBB(20.0, 100.0, 30.0, 89.0, 151.0, 51.0)
+ private val lastGateBlock = BlockPos(8, 118, 50)
+
+ private const val ACTIVE_DEVICE_STRING = "\u00A7aDevice"
+ private const val INACTIVE_DEVICE_STRING = "\u00A7cInactive"
+
+ private val classes = listOf(DungeonClass.Archer, DungeonClass.Mage, DungeonClass.Berserk, DungeonClass.Healer, DungeonClass.Tank) | DungeonClass.entries? |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -0,0 +1,417 @@
+package me.odinclient.features.impl.floor7.p3
+
+import me.odinclient.utils.skyblock.PlayerUtils.rightClick
+import me.odinmain.events.impl.BlockChangeEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.*
+import me.odinmain.utils.clock.Clock
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.Renderer
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.skyblock.dungeon.DungeonClass
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.dungeon.M7Phases
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.client.settings.KeyBinding
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.util.AxisAlignedBB
+import net.minecraft.util.BlockPos
+import net.minecraft.util.Vec3
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+import org.lwjgl.input.Keyboard
+
+object ArrowsDevice : Module(
+ name = "Arrows Device",
+ description = "Different features for the Sharp Shooter puzzle in floor 7.",
+ category = Category.FLOOR7,
+ tag = TagType.RISKY,
+) {
+ private val solver: Boolean by BooleanSetting("Solver")
+ private val markedPositionColor: Color by ColorSetting("Marked Position", Color.RED, description = "Color of the marked position.").withDependency { solver }
+ private val targetPositionColor: Color by ColorSetting("Target Position", Color.GREEN, description = "Color of the target position.").withDependency { solver }
+ private val alertOnDeviceComplete: Boolean by BooleanSetting("Device complete alert", default = true, description = "Send an alert when device is complete")
+ private val resetKey: Keybinding by KeybindSetting("Reset", Keyboard.KEY_NONE, description = "Resets the solver.").onPress {
+ reset()
+ }.withDependency { solver }
+ private val depthCheck: Boolean by BooleanSetting("Depth check", true, description = "Marked positions show through walls.").withDependency { solver }
+ private val reset: () -> Unit by ActionSetting("Reset") {
+ markedPositions.clear()
+ autoState = AutoState.Stopped
+ actionQueue.clear()
+ }.withDependency { solver }
+ private val auto: Boolean by BooleanSetting("Auto", description = "Automatically complete device")
+ private val autoPhoenix: Boolean by BooleanSetting("Auto phoenix", default = true, description = "Automatically swap to phoenix pet using cast rod pet rules, must be set up correctly").withDependency { auto }
+ private val autoLeap: Boolean by BooleanSetting("Auto leap", default = true, description = "Automatically leap once device is done").withDependency { auto }
+ private val autoLeapClass: Int by SelectorSetting("Leap to", defaultSelected = "Archer", arrayListOf("Archer", "Mage", "Berserk", "Healer", "Tank"), description = "Who to leap to").withDependency { autoLeap && auto }
+ private val autoLeapOnlyPre: Boolean by BooleanSetting("Only leap on pre", default = true, description = "Only auto leap when doing i4").withDependency { autoLeap && auto }
+ private val delay: Long by NumberSetting("Delay", 150L, 80, 300, description = "Delay between actions").withDependency { auto }
+ private val aimingTime: Long by NumberSetting("Aiming duration", 100L, 80, 200, description = "Time taken to aim at a target").withDependency { auto }
+
+ private val markedPositions = mutableSetOf<BlockPos>()
+ private var targetPosition: BlockPos? = null
+
+ private var autoState = AutoState.Stopped
+ private var isPhoenixSwapping = false
+ private var isDeviceComplete = false
+ private var bowSlot = 0
+
+ // ArmorStand showing the status of the device
+ private var activeArmorStand: EntityArmorStand? = null
+
+ // Clock used for action delay (mostly for phoenix swapping and leap)
+ private val clock = Clock(delay)
+ private val actionQueue = ArrayDeque<() -> Unit>()
+
+ // Number of server ticks since the last target disappeared, or null if there is a target
+ private var serverTicksSinceLastTargetDisappeared: Int? = null;
+
+ init {
+ onMessage(Regex("^Your (?:. )?Bonzo's Mask saved your life!$"), { enabled && auto && autoPhoenix && isPlayerOnStand() }) {
+ phoenixSwap()
+ }
+
+ onMessage(Regex("^[a-zA-Z0-9_]{3,} completed a device! \\([1-7]/7\\)"), { enabled && isPlayerInRoom() }) {
+ onComplete()
+ }
+
+ onMessage(Regex("^ ☠ You died and became a ghost\\.$"), { enabled && isPlayerOnStand() }) {
+ // Died while on device
+ autoState = AutoState.Stopped
+ actionQueue.clear()
+ // Prevent the tick count from continuing and registering a false positive
+ // This does mean we could get a false negative but since the player is already
+ // dead knowing if the device is complete has less importance (no leaping)
+ serverTicksSinceLastTargetDisappeared = 11
+ }
+
+ execute(1000) {
+ if(DungeonUtils.getPhase() != M7Phases.P3) return@execute
+
+ // Cast is safe since we won't return an entity that isn't an armor stand
+ activeArmorStand = mc.theWorld?.loadedEntityList?.find {
+ it is EntityArmorStand && it.name.containsOneOf(INACTIVE_DEVICE_STRING, ACTIVE_DEVICE_STRING) && it.distanceSquaredTo(
+ standPosition.toVec3()) <= 4.0
+ } as EntityArmorStand?
+ }
+
+ onWorldLoad {
+ reset()
+ // Reset is called when leaving the device room, but device remains complete across an entire run, so this doesn't belong in reset
+ isDeviceComplete = false
+ }
+ }
+
+ private fun isDeviceRoomOpen(): Boolean {
+ val block = mc.theWorld.getBlockState(lastGateBlock)
+ return block == Blocks.air.defaultState
+ }
+
+ private fun isPlayerOnStand(): Boolean {
+ return (mc.thePlayer?.distanceSquaredTo(standPosition.toVec3()) ?: Double.MAX_VALUE) <= 1.0
+ }
+
+ private fun isPlayerInRoom(): Boolean {
+ return mc.thePlayer?.let { roomBoundingBox.isVecInside(it.positionVector) } ?: false
+ }
+
+ private fun holdClick() {
+ if(!mc.gameSettings.keyBindUseItem.isPressed) {
+ KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.keyCode, true)
+ }
+ }
+
+ private fun releaseClick() {
+ if(mc.gameSettings.keyBindUseItem.isPressed) {
+ KeyBinding.setKeyBindState(mc.gameSettings.keyBindUseItem.keyCode, false)
+ }
+ }
+
+ private fun setCurrentSlot(slot: Int) {
+ mc.thePlayer.inventory.currentItem = slot
+ }
+
+ private fun holdBow() {
+ if((mc.thePlayer?.inventory?.currentItem ?: -1) != bowSlot) {
+ mc.thePlayer.inventory.currentItem = bowSlot
+ }
+ }
+
+ private fun phoenixSwap() {
+ val rodSlot = mc.thePlayer?.inventory?.mainInventory?.indexOfFirst { it.isFishingRod } ?: -1;
+
+ if (rodSlot < 0 || rodSlot >= 9) {
+ modMessage("Couldn't find rod for phoenix swap")
+ return
+ }
+
+ releaseClick()
+
+ isPhoenixSwapping = true
+
+ modMessage("Phoenix swapping")
+
+ clock.update()
+
+ actionQueue.addAll(listOf(
+ {
+ // I would use swapToIndex, but for some reason it doesn't work, so this is it
+ setCurrentSlot(rodSlot)
+ },
+ {
+ rightClick()
+ },
+ {
+ setCurrentSlot(bowSlot)
+ isPhoenixSwapping = false
+ }
+ ))
+ }
+
+ private fun leap() {
+ val leapSlot = mc.thePlayer?.inventory?.mainInventory?.indexOfFirst { it.isLeap } ?: -1
+
+ if (leapSlot < 0 || leapSlot >= 9) {
+ modMessage("Couldn't find leaps for auto leap")
+ return
+ }
+
+ if (DungeonUtils.leapTeammates.isEmpty()) {
+ modMessage("Can't leap, there are no teammates")
+ return
+ }
+
+ modMessage("Leaping")
+
+ autoState = AutoState.Leaping
+
+ clock.update()
+
+ actionQueue.addAll(listOf(
+ {
+ setCurrentSlot(leapSlot)
+ },
+ {
+ autoState = AutoState.WaitingOnLeapingGui
+ rightClick()
+ }
+ ))
+ }
+
+ private fun aimAtTarget() {
+ targetPosition?.let {
+
+ if(isPhoenixSwapping) {
+ // We are busy with swapping to phoenix, so wait until that's done
+ actionQueue.add(::aimAtTarget)
+ return
+ }
+
+ val index = positions.indexOf(it)
+ // Position of the target in the grid
+ val x = index % 3
+ val y = index / 3
+
+ // Choose a correct target to hit as many blocks as possible
+ val target = Vec3(
+ if (x == 0 || (x == 1 && markedPositions.contains(positions[x + 1 + y * 3]))) { 67.5 } else { 65.5 },
+ 131.3 - 2 * y,
+ 50.0
+ )
+
+ holdBow()
+ holdClick()
+ val (_, yaw, pitch) = getDirectionToVec3(target)
+ smoothRotateTo(yaw, pitch, aimingTime) {
+ autoState = AutoState.Shooting
+ holdBow()
+ }
+ }
+ }
+
+ // There are 3 detection methods for device completion:
+ // - Message: If the '... completed a device! (1/7)' message is sent, this is usually the fastest way to detect,
+ // but doesn't always work (sometimes the message simply doesn't get sent, especially in i4)
+ // - ArmorStand: If the 'Device Active' text is displayed, this always works but is the slowest
+ // - Ticks: If the next emerald block doesn't appear for 10 (or more) server ticks, this is faster than the checking
+ // for the text most of the time (but not always) also can fail if the player leaves the device before those 10
+ // ticks are up
+ // We use all three here since we want to detect as soon as possible (since we might die if we wait too long).
+ private fun onComplete() {
+ if(isDeviceComplete) return
+
+ isDeviceComplete = true
+ releaseClick()
+
+ if(alertOnDeviceComplete) {
+ modMessage("Sharp shooter device complete")
+ PlayerUtils.alert("Device Complete", color = Color.GREEN)
+ }
+
+ autoState = AutoState.Stopped
+
+ if (auto && autoLeap && (!autoLeapOnlyPre || !isDeviceRoomOpen())) {
+ leap()
+ }
+ }
+
+ @SubscribeEvent
+ fun guiOpen(event: GuiOpenEvent) {
+ if (autoState != AutoState.WaitingOnLeapingGui) return
+ val chest = (event.gui as? GuiChest)?.inventorySlots ?: return
+ if (chest !is ContainerChest || chest.name != "Spirit Leap" || DungeonUtils.leapTeammates.isEmpty()) return
+
+ val leapTo = DungeonUtils.leapTeammates.firstOrNull { it.clazz == classes[autoLeapClass] } ?: DungeonUtils.leapTeammates.first()
+
+ clock.update()
+
+ actionQueue.add {
+ getItemIndexInContainerChest(chest, leapTo.name, 11..16)?.let {
+ PlayerUtils.windowClick(it, PlayerUtils.ClickType.Middle, instant = false)
+ }
+ autoState = AutoState.Stopped
+ }
+ }
+
+ @SubscribeEvent
+ fun onTick(tickEvent: ClientTickEvent) {
+ if(!isPlayerInRoom()) {
+ reset()
+ return
+ }
+
+ if(!isDeviceComplete && activeArmorStand?.name == ACTIVE_DEVICE_STRING) {
+ onComplete()
+ }
+
+ if (autoState != AutoState.Stopped) {
+ if (!isPlayerOnStand()) {
+ autoState = AutoState.Stopped
+ releaseClick()
+ return
+ }
+
+ if (autoState == AutoState.Shooting && !isPhoenixSwapping) {
+ holdClick()
+ }
+
+ if (clock.hasTimePassed(delay) && actionQueue.isNotEmpty()) {
+ actionQueue.removeFirst()()
+ clock.update()
+ }
+ }
+ }
+
+
+ @SubscribeEvent
+ fun onServerTick(event: RealServerTick) {
+ serverTicksSinceLastTargetDisappeared = serverTicksSinceLastTargetDisappeared?.let {
+ // There was no target last tick (or the count would be null)
+
+ if(targetPosition != null) {
+ // A target appeared
+ return@let null
+ } else if (it < 10) {
+ // No target yet, count the ticks
+ return@let it + 1
+ } else if (it == 10) {
+ // We reached 10 ticks, device is either done, or the player left the stand
+ if(isPlayerOnStand()) onComplete()
+ return@let 11
+ } else {
+ return@let 11
+ }
+ } ?: run {
+ // There was a target last tick (or one appeared this tick
+
+ // Check if target disappeared, set count accordingly
+ return@run if (targetPosition == null) 0 else null
+ }
+ }
+
+ @SubscribeEvent
+ fun onBlockChange(event: BlockChangeEvent) {
+ if (!DungeonUtils.inDungeons || DungeonUtils.getPhase() != M7Phases.P3 || !positions.contains(event.pos)) return
+
+ // Target was hit
+ if (event.old.block == Blocks.emerald_block && event.update.block == Blocks.stained_hardened_clay) {
+ markedPositions.add(event.pos)
+ // This condition should always be true but im never sure with Hypixel
+ if (targetPosition == event.pos) {
+ targetPosition = null
+
+ if(autoState != AutoState.Stopped) {
+ //releaseClick()
+ autoState = AutoState.Aiming
+ }
+ }
+ }
+
+ // New target appeared
+ if (event.old.block == Blocks.stained_hardened_clay && event.update.block == Blocks.emerald_block) {
+ // Can happen with resets
+ markedPositions.remove(event.pos)
+ targetPosition = event.pos
+
+ if (isPlayerOnStand() && auto) {
+ if (autoState == AutoState.Stopped) {
+ bowSlot = mc.thePlayer?.inventory?.mainInventory?.indexOfFirst { it.isShortbow } ?: -1;
+
+ if (bowSlot < 0 || bowSlot >= 9) {
+ modMessage("Couldn't find shortbow for auto sharp shooter")
+ return
+ }
+
+ modMessage("Starting sharp shooter")
+ }
+
+ autoState = AutoState.Aiming
+ aimAtTarget()
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRenderWorldLast(event: RenderWorldLastEvent) {
+ if (!DungeonUtils.inDungeons || DungeonUtils.getPhase() != M7Phases.P3 || !solver) return
+ markedPositions.forEach {
+ Renderer.drawBlock(it, markedPositionColor, depth = depthCheck)
+ }
+ targetPosition?.let {
+ Renderer.drawBlock(it, targetPositionColor, depth = depthCheck)
+ }
+ }
+
+ // This is order dependent
+ private val positions = listOf(
+ BlockPos(68, 130, 50), BlockPos(66, 130, 50), BlockPos(64, 130, 50),
+ BlockPos(68, 128, 50), BlockPos(66, 128, 50), BlockPos(64, 128, 50),
+ BlockPos(68, 126, 50), BlockPos(66, 126, 50), BlockPos(64, 126, 50)
+ )
+
+ // Position of the pressure plate for auto
+ private val standPosition = BlockPos(63.5, 127.0, 35.5)
+ private val roomBoundingBox = AxisAlignedBB(20.0, 100.0, 30.0, 89.0, 151.0, 51.0)
+ private val lastGateBlock = BlockPos(8, 118, 50)
+
+ private const val ACTIVE_DEVICE_STRING = "\u00A7aDevice" | cant you just write § ? |
Odin | github_2023 | others | 85 | odtheking | freebonsai | @@ -0,0 +1,193 @@
+package me.odin.features.impl.floor7.p3
+
+import me.odinmain.events.impl.BlockChangeEvent
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.utils.*
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.Renderer
+import me.odinmain.utils.skyblock.*
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+import me.odinmain.utils.skyblock.dungeon.M7Phases
+import net.minecraft.entity.item.EntityArmorStand
+import net.minecraft.init.Blocks
+import net.minecraft.util.AxisAlignedBB
+import net.minecraft.util.BlockPos
+import net.minecraftforge.client.event.RenderWorldLastEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+import org.lwjgl.input.Keyboard
+
+object ArrowsDevice : Module(
+ name = "Arrows Device",
+ description = "Solver for the Sharp Shooter puzzle in floor 7.",
+ category = Category.FLOOR7,
+) {
+ private val solver: Boolean by BooleanSetting("Solver")
+ private val markedPositionColor: Color by ColorSetting("Marked Position", Color.RED, description = "Color of the marked position.").withDependency { solver }
+ private val targetPositionColor: Color by ColorSetting("Target Position", Color.GREEN, description = "Color of the target position.").withDependency { solver }
+ private val alertOnDeviceComplete: Boolean by BooleanSetting("Device complete alert", default = true, description = "Send an alert when device is complete")
+ private val resetKey: Keybinding by KeybindSetting("Reset", Keyboard.KEY_NONE, description = "Resets the solver.").onPress {
+ reset()
+ }.withDependency { solver }
+ private val depthCheck: Boolean by BooleanSetting("Depth check", true, description = "Marked positions show through walls.").withDependency { solver }
+ private val reset: () -> Unit by ActionSetting("Reset") {
+ markedPositions.clear()
+ }.withDependency { solver }
+
+ private val markedPositions = mutableSetOf<BlockPos>()
+ private var targetPosition: BlockPos? = null
+
+ private var isDeviceComplete = false
+
+ // ArmorStand showing the status of the device
+ private var activeArmorStand: EntityArmorStand? = null
+
+ // Number of server ticks since the last target disappeared, or null if there is a target
+ private var serverTicksSinceLastTargetDisappeared: Int? = null
+
+ init {
+ onMessage(Regex("^[a-zA-Z0-9_]{3,} completed a device! \\([1-7]/7\\)"), { enabled && isPlayerInRoom }) {
+ onComplete()
+ }
+
+ onMessage(Regex("^ ☠ You died and became a ghost\\.$"), { enabled && isPlayerOnStand }) {
+ // Prevent the tick count from continuing and registering a false positive
+ // This does mean we could get a false negative but since the player is already
+ // dead knowing if the device is complete has less importance (no leaping)
+ serverTicksSinceLastTargetDisappeared = 11
+ }
+
+ execute(1000) {
+ if (DungeonUtils.getPhase() != M7Phases.P3) return@execute
+
+ // Cast is safe since we won't return an entity that isn't an armor stand | you can just filterIsInstance<EntityArmorStand>() before your find and you will not need to cast |
Odin | github_2023 | others | 90 | odtheking | odtheking | @@ -35,17 +48,29 @@ object TerminalSounds : Module(
customSound == "note.pling" ||
soundName != "note.pling" ||
volume != 8f ||
- pitch != 4.047619f
+ pitch != 4.047619f ||
+ !clickSounds
) return
playTerminalSound()
event.isCanceled = true
}
}
+ @SubscribeEvent
+ fun onTermComplete(event: TerminalSolvedEvent) {
+ if (event.type == TerminalTypes.NONE || mc.currentScreen is TermSimGui || event.playerName != mc.thePlayer?.name.noControlCodes || !completeSounds) return | mc.theplayer.name will never have color codes |
Odin | github_2023 | others | 90 | odtheking | odtheking | @@ -39,4 +46,59 @@ object TerminalTimes : Module(
termPBs.time(event.type.ordinal, (System.currentTimeMillis() - startTimer) / 1000.0, "s§7!", "§a${event.type.guiName} §7solved in §6", addPBString = true, addOldPBString = true, sendOnlyPB = sendMessage)
type = TerminalTypes.NONE
}
+
+ private val terminalCompleteRegex = Regex("(.{1,16}) (activated|completed) a (terminal|lever|device)! \\((\\d)/(\\d)\\)")
+
+ private var gateBlown = false
+ private var completed: Pair<Int, Int> = Pair(0, 7)
+ private var phaseTimer = 0L
+ private var sectionTimer = 0L
+ private val times = mutableListOf<Long>()
+
+ @SubscribeEvent
+ fun onMessage(event: ClientChatReceivedEvent) {
+ if (event.message.unformattedText.noControlCodes.matches(terminalCompleteRegex) && terminalSplits) event.isCanceled = true
+ }
+
+ init {
+ onMessage("The gate has been destroyed!", false, { terminalSplits }) { | need to add enabled as well for onmessage if u are overriding the default |
Odin | github_2023 | others | 90 | odtheking | odtheking | @@ -39,4 +46,59 @@ object TerminalTimes : Module(
termPBs.time(event.type.ordinal, (System.currentTimeMillis() - startTimer) / 1000.0, "s§7!", "§a${event.type.guiName} §7solved in §6", addPBString = true, addOldPBString = true, sendOnlyPB = sendMessage)
type = TerminalTypes.NONE
}
+
+ private val terminalCompleteRegex = Regex("(.{1,16}) (activated|completed) a (terminal|lever|device)! \\((\\d)/(\\d)\\)")
+
+ private var gateBlown = false
+ private var completed: Pair<Int, Int> = Pair(0, 7)
+ private var phaseTimer = 0L
+ private var sectionTimer = 0L
+ private val times = mutableListOf<Long>()
+
+ @SubscribeEvent
+ fun onMessage(event: ClientChatReceivedEvent) {
+ if (event.message.unformattedText.noControlCodes.matches(terminalCompleteRegex) && terminalSplits) event.isCanceled = true
+ }
+
+ init {
+ onMessage("The gate has been destroyed!", false, { terminalSplits }) {
+ if (completed.first == completed.second) resetSection()
+ else gateBlown = true
+ }
+
+ onMessage("[BOSS] Goldor: Who dares trespass into my domain?", false, { terminalSplits }) { | same as one above |
Odin | github_2023 | others | 90 | odtheking | odtheking | @@ -39,4 +46,59 @@ object TerminalTimes : Module(
termPBs.time(event.type.ordinal, (System.currentTimeMillis() - startTimer) / 1000.0, "s§7!", "§a${event.type.guiName} §7solved in §6", addPBString = true, addOldPBString = true, sendOnlyPB = sendMessage)
type = TerminalTypes.NONE
}
+
+ private val terminalCompleteRegex = Regex("(.{1,16}) (activated|completed) a (terminal|lever|device)! \\((\\d)/(\\d)\\)")
+
+ private var gateBlown = false
+ private var completed: Pair<Int, Int> = Pair(0, 7)
+ private var phaseTimer = 0L
+ private var sectionTimer = 0L
+ private val times = mutableListOf<Long>()
+
+ @SubscribeEvent
+ fun onMessage(event: ClientChatReceivedEvent) {
+ if (event.message.unformattedText.noControlCodes.matches(terminalCompleteRegex) && terminalSplits) event.isCanceled = true
+ }
+
+ init {
+ onMessage("The gate has been destroyed!", false, { terminalSplits }) {
+ if (completed.first == completed.second) resetSection()
+ else gateBlown = true
+ }
+
+ onMessage("[BOSS] Goldor: Who dares trespass into my domain?", false, { terminalSplits }) {
+ resetSection(true)
+ }
+
+ onMessage(terminalCompleteRegex, { terminalSplits }) {
+ val matchResult = terminalCompleteRegex.find(it)?.groups ?: return@onMessage
+ val complete = Pair(matchResult[4]?.value?.toIntOrNull() ?: return@onMessage, matchResult[5]?.value?.toIntOrNull() ?: return@onMessage) | use destructured to define all the groups from the matchresult |
Odin | github_2023 | others | 90 | odtheking | freebonsai | @@ -0,0 +1,106 @@
+package me.odinmain.features.impl.floor7
+
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.DualSetting
+import me.odinmain.features.settings.impl.HudSetting
+import me.odinmain.ui.hud.HudElement
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.mcTextAndWidth
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+
+object TickTimers : Module(
+ name = "Tick Timers",
+ category = Category.FLOOR7,
+ description = "Various tick timers for the floor 7 boss."
+) {
+ private val displayInTicks: Boolean by DualSetting("Timer Style", "Seconds", "Ticks", default = false, description = "Which Style to display the timers in")
+ private val symbolDisplay: Boolean by BooleanSetting("Display Symbol", default = true, description = "Displays s or t after the timers")
+ private val showPrefix: Boolean by BooleanSetting("Show Prefix", default = true, description = "Shows the prefix of the timers")
+
+ private val necronHud: HudElement by HudSetting("Necron Hud", 10f, 10f, 1f, true) {
+ if (it) {
+ mcTextAndWidth(formatTimer(35, 60, "§4Necron dropping in"), 1f, 1f, 2, Color.DARK_RED, shadow = true, center = false) * 2 + 2f to 16f
+ } else if (necronTime >= 0) {
+ mcTextAndWidth(formatTimer(necronTime.toInt(), 60, "§4Necron dropping in"), 1f, 1f, 2, Color.DARK_RED, shadow = true, center = false) * 2 + 2f to 16f
+ } else 0f to 0f
+ }
+
+ private var necronTime: Byte = -1
+
+ private val goldorHud: HudElement by HudSetting("Goldor Hud", 10f, 10f, 1f, true) {
+ if (it) {
+ mcTextAndWidth(formatTimer(35, 60, "§7Tick:"), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else if ((goldorStartTime >= 0 && startTimer) || goldorTickTime >= 0) {
+ val (prefix: String, time: Int, max: Int) = if (goldorStartTime >= 0 && startTimer) Triple("§aStart:", goldorStartTime, 104) else Triple("§7Tick:", goldorTickTime, 60)
+ mcTextAndWidth(formatTimer(time, max, prefix), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else 0f to 0f
+ }
+ private val startTimer: Boolean by BooleanSetting("Start timer", default = false, description = "Displays a timer counting down until devices/terms are able to be activated/completed.").withDependency { goldorHud.enabled }
+
+ private var goldorTickTime: Int = -1
+ private var goldorStartTime: Int = -1
+
+ private val stormHud: HudElement by HudSetting("Storm Pad Hud", 10f, 10f, 1f, true) {
+ if (it) {
+ mcTextAndWidth(formatTimer(15, 20, "§bPad:"), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else if (padTickTime >= 0) {
+ mcTextAndWidth(formatTimer(padTickTime, 20, "§bPad:"), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else 0f to 0f
+ }
+
+ private var padTickTime: Int = -1
+
+ init {
+ onMessage(Regex("\\[BOSS] Necron: I'm afraid, your journey ends now\\."), { enabled && necronHud.enabled }) { necronTime = 60 }
+
+ onMessage(Regex("\\[BOSS] Goldor: Who dares trespass into my domain\\?"), { enabled && goldorHud.enabled }) { goldorTickTime = 60 }
+ onMessage(Regex("The Core entrance is opening!"), { enabled && goldorHud.enabled }) {
+ goldorTickTime = -1
+ goldorStartTime = -1
+ }
+
+ onMessage(Regex("\\[BOSS] Storm: I should have known that I stood no chance\\.")) {
+ if (goldorHud.enabled) goldorStartTime = 104
+ if (stormHud.enabled) padTickTime = 20
+ }
+
+ onMessage(Regex("\\[BOSS] Storm: I should have known that I stood no chance\\."), { enabled && stormHud.enabled }) { padTickTime = -1 } | What |
Odin | github_2023 | others | 90 | odtheking | freebonsai | @@ -0,0 +1,106 @@
+package me.odinmain.features.impl.floor7
+
+import me.odinmain.events.impl.RealServerTick
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.BooleanSetting
+import me.odinmain.features.settings.impl.DualSetting
+import me.odinmain.features.settings.impl.HudSetting
+import me.odinmain.ui.hud.HudElement
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.mcTextAndWidth
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent
+
+object TickTimers : Module(
+ name = "Tick Timers",
+ category = Category.FLOOR7,
+ description = "Various tick timers for the floor 7 boss."
+) {
+ private val displayInTicks: Boolean by DualSetting("Timer Style", "Seconds", "Ticks", default = false, description = "Which Style to display the timers in")
+ private val symbolDisplay: Boolean by BooleanSetting("Display Symbol", default = true, description = "Displays s or t after the timers")
+ private val showPrefix: Boolean by BooleanSetting("Show Prefix", default = true, description = "Shows the prefix of the timers")
+
+ private val necronHud: HudElement by HudSetting("Necron Hud", 10f, 10f, 1f, true) {
+ if (it) {
+ mcTextAndWidth(formatTimer(35, 60, "§4Necron dropping in"), 1f, 1f, 2, Color.DARK_RED, shadow = true, center = false) * 2 + 2f to 16f
+ } else if (necronTime >= 0) {
+ mcTextAndWidth(formatTimer(necronTime.toInt(), 60, "§4Necron dropping in"), 1f, 1f, 2, Color.DARK_RED, shadow = true, center = false) * 2 + 2f to 16f
+ } else 0f to 0f
+ }
+
+ private var necronTime: Byte = -1
+
+ private val goldorHud: HudElement by HudSetting("Goldor Hud", 10f, 10f, 1f, true) {
+ if (it) {
+ mcTextAndWidth(formatTimer(35, 60, "§7Tick:"), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else if ((goldorStartTime >= 0 && startTimer) || goldorTickTime >= 0) {
+ val (prefix: String, time: Int, max: Int) = if (goldorStartTime >= 0 && startTimer) Triple("§aStart:", goldorStartTime, 104) else Triple("§7Tick:", goldorTickTime, 60)
+ mcTextAndWidth(formatTimer(time, max, prefix), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else 0f to 0f
+ }
+ private val startTimer: Boolean by BooleanSetting("Start timer", default = false, description = "Displays a timer counting down until devices/terms are able to be activated/completed.").withDependency { goldorHud.enabled }
+
+ private var goldorTickTime: Int = -1
+ private var goldorStartTime: Int = -1
+
+ private val stormHud: HudElement by HudSetting("Storm Pad Hud", 10f, 10f, 1f, true) {
+ if (it) {
+ mcTextAndWidth(formatTimer(15, 20, "§bPad:"), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else if (padTickTime >= 0) {
+ mcTextAndWidth(formatTimer(padTickTime, 20, "§bPad:"), 1f, 1f, 2, Color.DARK_RED, shadow = true ,center = false) * 2 + 2f to 16f
+ } else 0f to 0f
+ }
+
+ private var padTickTime: Int = -1
+
+ init {
+ onMessage(Regex("\\[BOSS] Necron: I'm afraid, your journey ends now\\."), { enabled && necronHud.enabled }) { necronTime = 60 }
+
+ onMessage(Regex("\\[BOSS] Goldor: Who dares trespass into my domain\\?"), { enabled && goldorHud.enabled }) { goldorTickTime = 60 }
+ onMessage(Regex("The Core entrance is opening!"), { enabled && goldorHud.enabled }) {
+ goldorTickTime = -1
+ goldorStartTime = -1
+ }
+
+ onMessage(Regex("\\[BOSS] Storm: I should have known that I stood no chance\\.")) {
+ if (goldorHud.enabled) goldorStartTime = 104
+ if (stormHud.enabled) padTickTime = 20
+ }
+
+ onMessage(Regex("\\[BOSS] Storm: I should have known that I stood no chance\\."), { enabled && stormHud.enabled }) { padTickTime = -1 }
+
+ onWorldLoad {
+ if (necronHud.enabled) necronTime = -1
+ if (goldorHud.enabled) {
+ goldorTickTime = -1
+ goldorStartTime = -1
+ }
+ if (stormHud.enabled) padTickTime = -1
+ } | Do u really need the if checks here? |
Odin | github_2023 | others | 90 | odtheking | freebonsai | @@ -22,6 +27,8 @@ object TerminalTimes : Module(
modMessage("§6Terminal PBs §fhave been reset.")
}
+ private val terminalSplits: Boolean by BooleanSetting("Terminal Splits", default = true, description = "Adds the time when a term was completed to its message, and sends the total term time after terms are done.")
+ | Doesnt this fit way better in the splits module? |
Odin | github_2023 | others | 87 | odtheking | freebonsai | @@ -103,7 +103,7 @@ object CanClip : Module(
else -> return
}
- if (line) Renderer.draw3DLine(pos1, pos2, color = Color.RED)
+ if (line) Renderer.draw3DLine(pos1, pos2, color = Color.RED, depth = true) | should depth be true there? seems nicer to be able to see it through blocks |
Odin | github_2023 | others | 81 | odtheking | freebonsai | @@ -0,0 +1,68 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.utils.skyblock.LocationUtils.inSkyblock
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.item.ItemBlock
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.client.event.GuiScreenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+/**
+ * Module to automatically do the Melody's Harp minigame.
+ *
+ * Modified from: https://github.com/FloppaCoding/FloppaClient/blob/master/src/main/kotlin/floppaclient/module/impl/misc/AutoHarp.kt
+ *
+ * @author Aton
+ */
+object AutoHarp : Module(
+ "Auto Harp",
+ category = Category.SKYBLOCK,
+ description = "Automatically Completes Melody's Harp"
+){
+ private var inHarp = false
+ private var lastInv = 0
+
+ @SubscribeEvent
+ fun onGuiOpen(event: GuiOpenEvent) {
+ if (event.gui !is GuiChest || !inSkyblock) return
+ val container = (event.gui as GuiChest).inventorySlots
+ if (container is ContainerChest) {
+ val chestName = container.lowerChestInventory.displayName.unformattedText
+ if (chestName.startsWith("Harp -")) {
+ inHarp = true
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRender(event: GuiScreenEvent.BackgroundDrawnEvent) {
+ if (!inHarp || mc.thePlayer == null) return
+ val container = mc.thePlayer.openContainer ?: return
+ if (container !is ContainerChest) return
+ val inventoryName = container.inventorySlots?.get(0)?.inventory?.name
+ if (inventoryName == null || !inventoryName.startsWith("Harp -")) {
+ inHarp = false
+ return
+ }
+ val newHash = container.inventorySlots.subList(0,36).joinToString("") { it?.stack?.displayName ?: "" }.hashCode()
+ if (lastInv == newHash) return
+ lastInv = newHash
+ for (ii in 0..6) {
+ val slot = container.inventorySlots[37 + ii]
+ if ((slot.stack?.item as? ItemBlock)?.block === Blocks.quartz_block) {
+ mc.playerController.windowClick( | use PlayerUtils.windowclick (look at autoterms or something) |
Odin | github_2023 | others | 81 | odtheking | freebonsai | @@ -0,0 +1,68 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.utils.skyblock.LocationUtils.inSkyblock
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.item.ItemBlock
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.client.event.GuiScreenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+/**
+ * Module to automatically do the Melody's Harp minigame.
+ *
+ * Modified from: https://github.com/FloppaCoding/FloppaClient/blob/master/src/main/kotlin/floppaclient/module/impl/misc/AutoHarp.kt
+ *
+ * @author Aton
+ */
+object AutoHarp : Module(
+ "Auto Harp",
+ category = Category.SKYBLOCK,
+ description = "Automatically Completes Melody's Harp"
+){
+ private var inHarp = false
+ private var lastInv = 0
+
+ @SubscribeEvent
+ fun onGuiOpen(event: GuiOpenEvent) {
+ if (event.gui !is GuiChest || !inSkyblock) return
+ val container = (event.gui as GuiChest).inventorySlots
+ if (container is ContainerChest) {
+ val chestName = container.lowerChestInventory.displayName.unformattedText
+ if (chestName.startsWith("Harp -")) {
+ inHarp = true
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onRender(event: GuiScreenEvent.BackgroundDrawnEvent) { | Use a tickevent instead of a renderevent |
Odin | github_2023 | others | 81 | odtheking | freebonsai | @@ -0,0 +1,68 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.utils.skyblock.LocationUtils.inSkyblock
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import net.minecraft.item.ItemBlock
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.client.event.GuiScreenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+/**
+ * Module to automatically do the Melody's Harp minigame.
+ *
+ * Modified from: https://github.com/FloppaCoding/FloppaClient/blob/master/src/main/kotlin/floppaclient/module/impl/misc/AutoHarp.kt
+ *
+ * @author Aton
+ */
+object AutoHarp : Module(
+ "Auto Harp",
+ category = Category.SKYBLOCK,
+ description = "Automatically Completes Melody's Harp"
+){
+ private var inHarp = false
+ private var lastInv = 0
+
+ @SubscribeEvent
+ fun onGuiOpen(event: GuiOpenEvent) {
+ if (event.gui !is GuiChest || !inSkyblock) return
+ val container = (event.gui as GuiChest).inventorySlots
+ if (container is ContainerChest) {
+ val chestName = container.lowerChestInventory.displayName.unformattedText | use ContainerChest.name extension value from Utils.kt, container.name in this case |
Odin | github_2023 | others | 81 | odtheking | freebonsai | @@ -0,0 +1,65 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.utils.skyblock.LocationUtils.inSkyblock
+import me.odinmain.utils.skyblock.PlayerUtils.windowClick
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import me.odinmain.utils.name
+import net.minecraft.item.ItemBlock
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+/**
+ * Module to automatically do the Melody's Harp minigame.
+ *
+ * Modified from: https://github.com/FloppaCoding/FloppaClient/blob/master/src/main/kotlin/floppaclient/module/impl/misc/AutoHarp.kt
+ *
+ * @author Aton
+ */
+object AutoHarp : Module(
+ "Auto Harp",
+ category = Category.SKYBLOCK,
+ description = "Automatically Completes Melody's Harp"
+){
+ private var inHarp = false
+ private var lastInv = 0
+
+ @SubscribeEvent
+ fun onGuiOpen(event: GuiOpenEvent) {
+ if (event.gui !is GuiChest || !inSkyblock) return
+ val container = (event.gui as GuiChest).inventorySlots
+ if (container is ContainerChest) {
+ val chestName = container.lowerChestInventory.displayName.unformattedText
+ if (chestName.startsWith("Harp -")) {
+ inHarp = true
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onClientTick(event: TickEvent.ClientTickEvent) {
+ if (!inHarp || mc.thePlayer == null) return
+ val container = mc.thePlayer.openContainer ?: return
+ if (container !is ContainerChest) return
+ val containerChest = mc.thePlayer.openContainer as? ContainerChest ?: return
+ if (containerChest.name == "Harp -") {
+ | remove extra space |
Odin | github_2023 | others | 81 | odtheking | freebonsai | @@ -0,0 +1,65 @@
+package me.odinclient.features.impl.skyblock
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.utils.skyblock.LocationUtils.inSkyblock
+import me.odinmain.utils.skyblock.PlayerUtils.windowClick
+import net.minecraft.client.gui.inventory.GuiChest
+import net.minecraft.init.Blocks
+import net.minecraft.inventory.ContainerChest
+import me.odinmain.utils.name
+import net.minecraft.item.ItemBlock
+import net.minecraftforge.client.event.GuiOpenEvent
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+/**
+ * Module to automatically do the Melody's Harp minigame.
+ *
+ * Modified from: https://github.com/FloppaCoding/FloppaClient/blob/master/src/main/kotlin/floppaclient/module/impl/misc/AutoHarp.kt
+ *
+ * @author Aton
+ */
+object AutoHarp : Module(
+ "Auto Harp",
+ category = Category.SKYBLOCK,
+ description = "Automatically Completes Melody's Harp"
+){
+ private var inHarp = false
+ private var lastInv = 0
+
+ @SubscribeEvent
+ fun onGuiOpen(event: GuiOpenEvent) {
+ if (event.gui !is GuiChest || !inSkyblock) return
+ val container = (event.gui as GuiChest).inventorySlots
+ if (container is ContainerChest) {
+ val chestName = container.lowerChestInventory.displayName.unformattedText
+ if (chestName.startsWith("Harp -")) {
+ inHarp = true
+ }
+ }
+ }
+
+ @SubscribeEvent
+ fun onClientTick(event: TickEvent.ClientTickEvent) {
+ if (!inHarp || mc.thePlayer == null) return
+ val container = mc.thePlayer.openContainer ?: return
+ if (container !is ContainerChest) return
+ val containerChest = mc.thePlayer.openContainer as? ContainerChest ?: return
+ if (containerChest.name == "Harp -") {
+
+ inHarp = false
+ return
+ }
+ val newHash = container.inventorySlots.subList(0,36).joinToString("") { it?.stack?.displayName ?: "" }.hashCode()
+ if (lastInv == newHash) return
+ lastInv = newHash
+ for (ii in 0..6) {
+ val slot = container.inventorySlots[37 + ii]
+ if ((slot.stack?.item as? ItemBlock)?.block === Blocks.quartz_block) {
+ windowClick(container.windowId, slot.slotNumber, 0, true) // Assuming left-click mode (0) and instant action (true) | PlayerUtils.windowClick(slot.slotNumber, PlayerUtils.ClickType.Left) |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -0,0 +1,49 @@
+package me.odinmain.features.impl.floor7.p3
+
+import me.odinmain.events.impl.PacketReceivedEvent
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.impl.floor7.p3.TerminalSolver.currentTerm
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.ActionSetting
+import me.odinmain.features.settings.impl.NumberSetting
+import me.odinmain.features.settings.impl.SelectorSetting
+import me.odinmain.features.settings.impl.StringSetting
+import me.odinmain.utils.skyblock.PlayerUtils
+import net.minecraft.network.play.server.S29PacketSoundEffect
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+
+object TerminalSounds : Module(
+ name = "Terminal Sounds",
+ category = Category.FLOOR7,
+ description = "Plays a sound whenever you click in a terminal"
+){
+ private val defaultSounds = arrayListOf("mob.blaze.hit", "random.pop", "random.orb", "random.break", "mob.guardian.land.hit", "Custom")
+ private val sound: Int by SelectorSetting("Sound", "mob.blaze.hit", defaultSounds, description = "Which sound to play when you click in a terminal")
+ private val customSound: String by StringSetting("Custom Sound", "mob.blaze.hit",
+ description = "Name of a custom sound to play. This is used when Custom is selected in the Sound setting.", length = 32
+ ).withDependency { sound == defaultSounds.size - 1 }
+ private val volume: Float by NumberSetting("Volume", 1f, 0, 1, .01f, description = "Volume of the sound.")
+ private val pitch: Float by NumberSetting("Pitch", 2f, 0, 2, .01f, description = "Pitch of the sound.")
+ val reset: () -> Unit by ActionSetting("Play sound") { playTerminalSound() }
+
+ private var lastPlayed = System.currentTimeMillis()
+
+ @SubscribeEvent
+ fun onPacket(event: PacketReceivedEvent){
+ with(event.packet) {
+ if (this !is S29PacketSoundEffect || currentTerm == TerminalTypes.NONE || customSound == "note.pling" ||
+ soundName != "note.pling" || volume != 8f || pitch != 4.047619f) return | if you want to make it multiple lines then make it like the other multiline if statements in the mod |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -30,6 +32,12 @@ object PlayerUtils {
shouldBypassVolume = false
}
+ fun playLoudSoundAtLocation(pos: Vec3, sound: String?, volume: Float, pitch: Float) { | make the other function call this function if you are going to have both |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -23,6 +23,37 @@ data class DungeonPlayer(
var isDead: Boolean = false
)
+data class Puzzle(
+ val name: String,
+ var status: PuzzleStatus? = null
+) {
+ companion object {
+ val Unknown = Puzzle("???")
+ val Blaze = Puzzle("Higher Or Lower")
+ val Beams = Puzzle("Creeper Beams")
+ val Weirdos = Puzzle("Three Weirdos")
+ val TTT = Puzzle("Tic Tac Toe")
+ val WaterBoard = Puzzle("Water Board")
+ val TPMaze = Puzzle("Teleport Maze")
+ val Boulder = Puzzle("Boulder")
+ val IceFill = Puzzle("Ice Fill")
+ val IcePath = Puzzle("Ice Path")
+ val Quiz = Puzzle("Quiz")
+ val BombDefuse = Puzzle("Bomb Defuse")
+
+ val allPuzzles = listOf(
+ Blaze, Beams, Weirdos, TTT, WaterBoard, TPMaze,
+ Boulder, IceFill, IcePath, Quiz, BombDefuse, Unknown
+ )
+ }
+}
+
+sealed class PuzzleStatus { | This should be an enum i think |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -23,6 +23,37 @@ data class DungeonPlayer(
var isDead: Boolean = false
)
+data class Puzzle(
+ val name: String,
+ var status: PuzzleStatus? = null
+) {
+ companion object { | this could also be an enum, then you wouldnt need the list |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -0,0 +1,97 @@
+package me.odinmain.features.impl.dungeon
+
+import me.odinmain.features.Category
+import me.odinmain.features.Module
+import me.odinmain.features.settings.Setting.Companion.withDependency
+import me.odinmain.features.settings.impl.*
+import me.odinmain.ui.clickgui.util.ColorUtil.withAlpha
+import me.odinmain.ui.hud.HudElement
+import me.odinmain.utils.render.Color
+import me.odinmain.utils.render.getMCTextWidth
+import me.odinmain.utils.render.mcText
+import me.odinmain.utils.render.roundedRectangle
+import me.odinmain.utils.skyblock.dungeon.DungeonUtils
+
+object MapInfo : Module(
+ name = "Map Info",
+ category = Category.DUNGEON,
+ description = "Displays various information about the current dungeon map"
+) {
+ private val disableInBoss: Boolean by BooleanSetting("Disable in boss", default = true, description = "Disables the information display when you're in boss.")
+ private val remaining: Boolean by DualSetting("Min Secrets", "Minimum", "Remaining", default = false, description = "Display minimum secrets or secrets until s+.")
+ private val unknown: Boolean by DualSetting("Deaths", "Deaths", "Unknown", default = false, description = "Display deaths or unknown secrets. (Unknown secrets are secrets in rooms that haven't been discovered yet. May not be helpful in full party runs.)")
+ val togglePaul: Int by SelectorSetting("Paul Settings", "Automatic", options = arrayListOf("Automatic", "Force Disable", "Force Enable"))
+ private val background: Boolean by BooleanSetting("Background", default = false, description = "Render a background behind the score info")
+ private val color: Color by ColorSetting("Background Color", default = Color.DARK_GRAY.withAlpha(0.5f), true, description = "The color of the background").withDependency { background }
+
+ val hud: HudElement by HudSetting("Hud", 10f, 10f, 1f, false) {
+ if (it) { | You dont need the if (it) statement if you initialize the variables with placeholder text anyway, then it can just show the last values in examplehud
Also the executor is unnecessary and you shouldnt really need them to be variables either, just use the mcTextAndWidth function and give the values in format strings |
Odin | github_2023 | others | 83 | odtheking | freebonsai | @@ -48,4 +62,14 @@ object EtherWarpHelper : Module(
Renderer.drawStyledBlock(pos, color, style, lineWidth, depthCheck)
}
}
+
+ @SubscribeEvent
+ fun onSoundPacket(event: PacketReceivedEvent) {
+ with(event.packet) {
+ if (this !is S29PacketSoundEffect || soundName != "mob.enderdragon.hit" || !sounds || volume != 1f || pitch != 0.53968257f || customSound == "mob.enderdragon.hit") return
+ val packet = S29PacketSoundEffect("minecraft:${if (sound == defaultSounds.size - 1) customSound else defaultSounds[sound]}", x, y, z, soundVolume, soundPitch)
+ mc.addScheduledTask { mc.netHandler.handleSoundEffect(packet) }
+ event.isCanceled = true
+ } | what the fuck |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.