Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Tier formula #2297

Closed
wants to merge 38 commits into from
Closed

Conversation

BlueWeabo
Copy link
Member

Implements the weighted tier formula discussed in the dev channel. Weights of each parts are only temporary and can be changed.

minecraft7771 and others added 29 commits August 8, 2023 16:40
* Fixed casing lists being cleared for every checked structure piece

* Fixed power being taken from any side BUT the right one
* Added 2nd structure tier to ACR and make complex parallels depend on it

* Added tier 3 to 8 structure pieces to ACR

* Added disclaimer

* Renamed ACR to ACP because MV CR already is named ACR
* Working auto push

* Revert wildcard import

* Addresssed reviews

* Fix reference issue
* Fixed ACP recipe map

* Fixed controller side being used instead of part side when accessing tanks
* fix cables not connecting

* fix structure and don't store controller
* Add missing tooltips

* Address blue's change
* Started work on DT MuTE

* Renamed methods so they also make sense when used horizontally
* Added cleanroom upgrade casing

* Added inventory and tank upgrades

* Added tooltips to mute casings

* Added power upgrades

* Set player UUID when placing MuTE
* Fixed pipes not connectable to MuTE casings

* Fixed not all things being renamed to ACP
* add a generic processing logic

* calculate tier in another method

* calculate power logic in another method
* Add the Foundry class and call it

* Foundry name correction

* Buildable stackable structure

* Fixed min stacks and added motor casings

* checkMachine override for custom checking

* Working checkMachine for all stacks, and recipes

* Fix getOutputFluids

* Change recipe processing to GenericProcessingLogic

* Change inventoryName to protected for override

* Override checkRecipe for multis that consume EU

* Rename class and add inner walls to multi

* Structure update and other fixes

* Fix processing logic being static
* Catch potential NPE

* Don't load name when it doesn't exist

* Potentially cause weird non-replicatable issue where registry ends up with different key

* Use proper block removal method

* Validate index before using it

* Don't open controller GUI from inventory upgrade

* semi-working concept

* sync the ID of the inventory upgrade to correctly remove it later

* remove unneeded boolean

---------

Co-authored-by: BlueWeabo <[email protected]>
* Added class containing MuTE relevant structure elements

* Migrate MuTE to new structure element

* Formatting fix

* Use int array instead of int hashmap, since its expected these arrays will never get long enough to be faster as hashmap

* Delete old code
* Introduce map of cached TEs, which are used to perform actions that don't require a specific instance of the TE. This prevents constant creation of new TEs

* Remove static modifier from map of cached TEs
* Base support for Heater MUCs

- Define Heater upgrade casings;
- Create the 5 tiers of Heaters;
- Add method to increase and decrease count.

* Refactor the cache of MUCs in structure

- Change the way that each MUC is counted: since there will be several types, the integer that counted heaters is now a hashmap that divides all MUCs based on their type and tier, to be counted separately from each other.

* Add Insulator MUC

- Add second MUC type (insulator) to test alongside heaters on the Layered Coke Battery.

* Fix MUC count reset

* Refactor MUC implementation into subclass

- Move the new methods and hashmap away from the base classes, and onto a s specific one that won't be used by unrelated multiblocks.

* Remove empty lines

* Refactor MUC implementations into subclasses

* Requested fixes in StackableModularController

* Change hashmap keys to an enum

* Hashmap getter for load order purposes

- Added a getter that generates the default value for the hashmap if it is null, due to problems with load order;

* Apply spotless

* NotNull annotations
* Fix old LCB multi name in some locations

* Refactor mucMap and override checkRecipe

- Refactor mucMap to an array of primitive integers instead of the wrapper type, for ease of use with other methods such as stream;
- Override checkRecipe for custom recipe behavior on MUC multis, to be implemented in a future commit;

* First implementation of bonuses and MUC requirements

- Change EU/t and recipe duration of this multi based on the count of different MUCs in the multi;
- Fail the structure check based on the count of each of the allowed MUCs.

* Parallel count implementation

- Calculate parallels based on the count of base MUCs, the cheapest option amongst the possibilities, in this case heaters;
- Added more abstract methods to require specific values from the multi classes.

* Fix parallel count and processing

- Fixed the handling of parallels by pointing to the corrent maxParallel variable in ProcessingLogic.

* Test of parallels with additional amp input

* Structure fix for the intended LCB

- Changed MUC placements to match what I intended at the beginning, to better test the multi.

* One more comment

* Remove checkRecipe override
* basics of inventory logic

* mostly working item logic

* working nbt saving/loading

* fluid handler

* FluidSlotHandler WIP

* fluid handler mostly working

* remove fluid handler from gt5u

* prepare for conversion

* use correct imports

* spotless

* more controller logic

* spotless

* final refactor. migration next

* spotless

* add more methods to logic classes

* convert almost everything to use new Logic

* spotless

* make mute casing mode an int

* allow pump cover to work with FluidInventoryLogic

* pumps work

* spotless

* make item inventory logic work with every item input thing

* rework Fluid Inventory Logic to work with all fluid inputs

* spotless

* address annotation reviews

* finish off todos

* missed to dos

* cleanup

Coke oven will get a new GUI when i get to it

* address review

* prevent npes from ControllerXXXLogic

* null checks
* saving.............

* clean up

* savin

* Small fixes + Adding back stuff, Crashes you and spams logs.

* fix stack overflow

* Fixes

* Fixes

---------

Co-authored-by: BlueWeabo <[email protected]>
* Add autopush functionality to MuTE (#1976)

* Working auto push

* Revert wildcard import

* Addresssed reviews

* Fix reference issue

* MuTE Upgrade Casings (#1988)

* Added cleanroom upgrade casing

* Added inventory and tank upgrades

* Added tooltips to mute casings

* Added power upgrades

* Set player UUID when placing MuTE

* Add a Generic Processing Logic and extract methods (#1992)

* add a generic processing logic

* calculate tier in another method

* calculate power logic in another method

* MuTE inventory upgrade logic (#2082)

* Catch potential NPE

* Don't load name when it doesn't exist

* Potentially cause weird non-replicatable issue where registry ends up with different key

* Use proper block removal method

* Validate index before using it

* Don't open controller GUI from inventory upgrade

* semi-working concept

* sync the ID of the inventory upgrade to correctly remove it later

* remove unneeded boolean

---------

Co-authored-by: BlueWeabo <[email protected]>

* MuTE casing structure element (#2105)

* Added class containing MuTE relevant structure elements

* Migrate MuTE to new structure element

* Formatting fix

* Use int array instead of int hashmap, since its expected these arrays will never get long enough to be faster as hashmap

* Delete old code

* Refactor Item and Fluid to be in separate logic classes (#2178)

* basics of inventory logic

* mostly working item logic

* working nbt saving/loading

* fluid handler

* FluidSlotHandler WIP

* fluid handler mostly working

* remove fluid handler from gt5u

* prepare for conversion

* use correct imports

* spotless

* more controller logic

* spotless

* final refactor. migration next

* spotless

* add more methods to logic classes

* convert almost everything to use new Logic

* spotless

* make mute casing mode an int

* allow pump cover to work with FluidInventoryLogic

* pumps work

* spotless

* make item inventory logic work with every item input thing

* rework Fluid Inventory Logic to work with all fluid inputs

* spotless

* address annotation reviews

* finish off todos

* missed to dos

* cleanup

Coke oven will get a new GUI when i get to it

* address review

* prevent npes from ControllerXXXLogic

* null checks

* Base work

* PollutionTask

* move package

* Fix generics

* Internal -> OverrideOnly

* rebase fix

* Ducttape addPollution

---------

Co-authored-by: Maxim <[email protected]>
Co-authored-by: BlueWeabo <[email protected]>
Co-authored-by: BlueWeabo <[email protected]>
* Add a way to enable or disable the crafting buffer on GPL multiblocks (#2218)

* add a way to enable or disable the crafting buffer on GPL multiblocks

* don't register the hatch either

* fix Refractory Capsule (#2219)

* Fix PAs overclocking ulv recipes too much (#2220)

* fix PAs overclocking ulv recipes too much

* make sure we save the returned value

* Fix Digital Tank capacity for Fluid Storage Monitor (#2217)

* Fix Digital Tank capacity for Fluid Storage Monitor

* Annotations

* Blacklist AE2FC drop and packet, and Chisel stones from Recycler (#2222)

* Fix recycler blacklist being sensitive to NBT

* Blacklist AE2FC drop and packet, and Chisel stones

* fix class loader issue

* Add detailed logging for ME hatches (#2224)

* Fix overclock calculator calculating eu/t use for ulv recipe wrong on certain parallel (#2225)

* fix overclock calculator calculating eu/t use for ulv recipe wrong on certain parallel

* make formula into its own method

* Fix drilling rigs, plants and concrete backfiller to fail with multiple energy hatches (#2227)

* max-1-energy-hatch-in-drilling-rigs.-plants-and-concrete-backfiller

* spotlessApply (#2228)

Co-authored-by: GitHub GTNH Actions <>

* revert

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* clear stale crafting input bus list (#2233)

* add ability to remove item data and use it for clay (#2229)

* Update buildscript (#2232)

* Fix server crash with RecipeFilter (#2231)

* Fix server crash with RecipeFilter

* Make client send filtered machines to server

* Use mUniqueIdentifier

* Fix a NPE w/ injecting into super/quantum chests (#2234)

When simulating an injection, if the stackSize > chest's capacity, it
causes a NPE when the internal chest is empty.

Also fixes a potential bug when void overflow is set; the chest should
return null in such a scenario regardless of simulation/modulation.

* Fix lag caused by getRecipeMap for PA (#2236)

* Experimental fix to prevent infinite loop in Grid destruction (#2235)

Co-authored-by: Firenoo <[email protected]>

* Fix ME Output Bus and Crafting Input Bus overflow when save/load (#2238)

* Remove fire display from singleblock generator (#2240)

* Fix some output slots allowing insertion (#2230)

* fix overlay zfighting by disable depth test (#2226)

* Crafting input - Optimize isEmpty check to reduce lag (#2239)

* Optimize isEmpty check

* rearrage

* remove broken hsla recipe (#2241)

* Correct PCB Factory Energy Hatch description (#2237)

* Correct PCB Factory Energy Hatch description

Changes the PCB factory description (the one seen when holding shift) which currently says "Energy Hatches: 1+"

I believe this is incorrect and that the correct description is 1-2 energy hatches or 1 TT energy hatch.

I believe the PCB factory uses this, which checks for 1-2 or 1 TT:

public boolean checkExoticAndNormalEnergyHatches() {
        if (mExoticEnergyHatches.isEmpty() && mEnergyHatches.isEmpty()) {
            return false;
        }

        if (!mExoticEnergyHatches.isEmpty()) {
            if (!mEnergyHatches.isEmpty()) {
                return false;
            }

            if (mExoticEnergyHatches.size() != 1) {
                return false;
            }
        }

        return mEnergyHatches.size() <= 2;
    }

* gradlew spotlessApply

* Correct file name on resource pack guide (#2242)

* Fix GT_RecipeConstants.Fuel (#2243)

* Update text (#2246)

* Fix startup tier for fusion NEI (#2249)

* Update the conditionals buttons and tooltips on covers to reflect their actual effects (#2244)

* Update redstone buttons and tooltips to better reflect actual use

* Spotless Apply

* Update GT_Cover_FluidRegulator.java

* Update GT_Cover_FluidRegulator.java

* Typo fix, Icon Improved and interactive blocking ui

- Fixed a typo in the world machine
- Fixed double button situation for conveyor belts.
  - There was never any issue, the testing methodology gave me invalid results.
  - Conveyor behaviour is in line with all the other covers affected by this PR/Branch.
- Updated icon for the machine state to be a miniature machine controller cover.
- Made the block/allow input section more interactive in order to better reflect the actual effect of these buttons.
  - In import mode, it actually blocks the machine from outputting from that side.

* typos

I can't write to save myself sometimes

* Better text alignment

- Better text alignment

* fix typos

I swear I can't write to save myself.

---------

Co-authored-by: Martin Robertz <[email protected]>

* Fix Orichalcum and Shadowiron smelting (#2251)

* fix orichalcum and shadowiron smelting

* add Alduorite and Chrysotile

* Fix tier display for Fusion NEI header (#2250)

* fix ulv recipes being broken again when under 1 tick calculation is taken (#2254)

* change way to fix zfighting (#2253)

* Crafting input hatches QoLs (#2200)

* Fixes + Detect Inventory Slot Changes

* support rename + check for updates

* add back onChangeListener + fix npe

* ICustomNameObject TileEntity

* Fix NPEs

* Use IInterfaceTerminalSupport

* fix

* register

* dep

* spotless

* General Crafting Input Hatch QoL fixes (#2212)

* feat: refactor naming && include circuit and catalyst in default name

* feat: add 4 more slot to solve my ocd

* fix: formatting

* feat: migrate from 4x8 to 4x9

* spotlessApply (#2213)

Co-authored-by: GitHub GTNH Actions <>

* QoLs

* 9 manual items

* spotless

* feat: open master GUI when used, without holding a data-stick (#2221)

* fix destpos

* optimize empty check

* Fix error when fluidInventory.size() == 0

If the fluidInventory size is 0, there is no element to get. Add a check
for it.

* name in waila + fix int overflow

* unnecssary super

* update deps

---------

Co-authored-by: Fox_white <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Firenoo <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>

* Use real stack limit (#2256)

* Fix incorrect data stick behaviors for hatches (#2257)

* Fix pcb factory not applying its roughness multiplier when it doesn't OC (#2258)

* fix PCB Factory not applying its roughness multiplier when it doesn't do any overclocks

* spotless

* Remove duplicate obsidian long rod (#2259)

* disable gt obsidian long rod

* cleaner code

* Add hazmat to ThaumicBoots (#2260)

* Add hazmat to ThaumicBoots

does what it says

* fixed

* fix item names (#2263)

* Fix renaming recipe check might ignore NBT equality (#2261)

* Fix GPL ignoring if the recipe is allowed to be cached (#2262)

* Added bricked blast furnace recipe progress to waila. (#2265)

* Added bricked blast furnace recipe progress to waila.

* fixed formatting issues.

* Fix cutter recipes not being added (#2271)

* add processing task

* clean up item logic host

* temporary fix for GT_StructrureMuTE

* use j9+ feature on pollution task

* prepare complex parallel logic for transition

* feature to ProcessingLogicHost

* fix up multiblock bases

* add processing logic for each multi to prepare for transition

* spotless

* removed debug text from wailaBody of GT_MetaTileEntity_Hatch_CraftingInput_ME (#2272)

* Proper recipe selection for output overflow in LCR and other multiblocks (#2247)

* Implement Stream<FindRecipeResult> findRecipesWithResult for GT_RecipeMap

* Change ProcessingLogic.process to actually use new  findRecipesWithResult

* Change ProcessingLogic.process to start finding something only for OUTPUT_FULL result

* Refactor ProcessingLogic.process to make logic more readable

* Replace while with for loop, remove NOT_FOUND return in end of findRecipesWithResult

* Apply spotless

* Make findRecipe use findRecipes, add annotation to GT_Recipe and FindRecipeResult for processRecipe and make method protected, replace wildcard imports

* Remake isRecipeWithOutputFullFound

* Add @nonnull to methods

* Apply spotless

* Remove Stream version of findRecipeWithResult, replace with predicate one. Add GT_Predicated_Recipe_Map class for utilizing this method. Changes some existent recipe maps to inherit from base class.

* Remove GT_Predicated_Recipe_Map, add Predicate directly to GT_Recipe_Map#findRecipeWithResult. Add AdvancedRecipeValidatorPredicate and FindRecipeWithAdvancedValidatorResult to allow store validation calculations for further use and proper errors displaying.

* Fix InsufficientVoltage errors

* Changes according to review comments. Integrate FindRecipeWithAdvancedValidatorResult to FindRecipeResult, rename AdvancedRecipeValidatorPredicate, encapsulate AdvancedRecipeValidatorPredicate fields, fixes some typos, etc

* Moves InsufficientVoltage check to GT_ParallelHelper. Removes FindRecipeResult#State#INSUFFICIENT_VOLTAGE

* Return an old findRecipeWithResult

* Renames things, call old methods for singleblocks

* Renames things, makes FindRecipeResult ctor private

* Apply spotless

* Move RecipeValidator, fix comments typos

* update deps

* fix up complex processing logic

* add a getter for voiding mode

* fix getAccessibleSlotsFromSide being wrong sometimes

* allow for subtraction of a specific item

* use long for amount

* add a setter for machine host

* initial work on finding recipes and input consumption

* Deprecate PA by removing its controller recipe (#2273)

* Restore PA controller recipe (#2276)

* Restore PA controller recipe

* Remove duplicated recipe

* Add optional description to input hatch constructors (#2278)

* mini fix (#2204)

* [chore] Bump fallback version to 44 (#2274)

* find recipe in theory working

* add some helper methods to inventory logics

* update deps

* use collect not toList

* fix loading crash

* fix complex processing logic using wrong find recipe

* fix up everything and get recipe finding working

* annotate and clean up methods

* spotless

* save things to nbt

* input separation for mutes and fully working processing

* apply mute mode on processing logic

* clean up overrides

---------

Co-authored-by: chochem <[email protected]>
Co-authored-by: miozune <[email protected]>
Co-authored-by: Pxx500 <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Glease <[email protected]>
Co-authored-by: firenoo <[email protected]>
Co-authored-by: Martin Robertz <[email protected]>
Co-authored-by: Harry <[email protected]>
Co-authored-by: Eraldoe <[email protected]>
Co-authored-by: Jakub <[email protected]>
Co-authored-by: Connor-Colenso <[email protected]>
Co-authored-by: Guillaume Mercier <[email protected]>
Co-authored-by: Fox_white <[email protected]>
Co-authored-by: Alastors <[email protected]>
Co-authored-by: Kyium <[email protected]>
Co-authored-by: SKProCH <[email protected]>
Co-authored-by: Sampsa <[email protected]>
Co-authored-by: Jaiden Baker <[email protected]>
@github-actions github-actions bot added the MuTE PRs concerning strictly the MuTE framework. label Sep 18, 2023
BlueWeabo and others added 5 commits September 19, 2023 06:16
* initial variables

* implement working void protection on items and fluids
* create a power output task which can be used for dynamos

* refactor the controllers and clean up

* add some documentation to power logic

* make a wireless network manager class instead of using an interface

* clean up and add documentation.

* setAmperage to setMaxAmperage

* fix comment

* remove IGlobalWirelessEnergy usage

* getAmperage -> getMaxAmperage

* add todo for future
@BlueWeabo BlueWeabo marked this pull request as ready for review September 25, 2023 11:17
@BlueWeabo BlueWeabo added the Affects Balance Change affecting balance. Requires admin approval before merging. label Sep 25, 2023
boubou19 and others added 3 commits September 25, 2023 21:10
* exit early

* spotless

* better side checking

* make if blocks mutually exclusive

* more exit early

* convert nested ternary operators into if blocks

* remove dead code

* collapse nested if blocks

* add todo to break verylong condition into much smaller ones

* spotless apply

* collapsing nested if blocks and more exit early

* spotless apply

* extract try/catch block to its own utility method

* break down this unreadable condition

* boolean magic (1/5)

* boolean magic (2/5)

Also corrected some logic on the player null check, we want it to be non null

* boolean magic (3/5)

* boolean magic (4/5)

* boolean magic (5/5)

* remove todo

* Fix logic

---------

Co-authored-by: Jason Mitchell <[email protected]>
Co-authored-by: BlueWeabo <[email protected]>
* clean up fixes

* actual fix and remove useless if
power.setEnergyCapacity(GT_Values.V[tier] * power.getMaxAmperage() * 2 * MINUTE);
power.setMaxVoltage(GT_Values.V[tier]);
power.setMaxAmperage(1);
long voltage = (long) Math.ceil(Math.pow(2, 3 + (2 * tier)));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't this lead up to max voltage like 8193 when tier is not an integer? can other part of the system handle such a thing? or is this how it is supposed to be done?

@BlueWeabo
Copy link
Member Author

Uhm. forgot about this. closing. nope not fixing it rn

@BlueWeabo BlueWeabo closed this Dec 27, 2023
@Dream-Master Dream-Master deleted the implementTierFormula branch December 27, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Affects Balance Change affecting balance. Requires admin approval before merging. MuTE PRs concerning strictly the MuTE framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.