<feed xmlns='http://www.w3.org/2005/Atom'>
<title>github/GT5-Unofficial.git/src/main/java/gregtech/common/misc/spaceprojects/interfaces, branch master</title>
<subtitle>Unnamed repository; edit this file 'description' to name the repository.</subtitle>
<link rel='alternate' type='text/html' href='https://git.nea.moe/github/GT5-Unofficial.git/'/>
<entry>
<title>Code cleanup (#2040)</title>
<updated>2023-06-05T04:51:28+00:00</updated>
<author>
<name>chill</name>
<email>chill.gtnh@outlook.com</email>
</author>
<published>2023-06-05T04:51:28+00:00</published>
<link rel='alternate' type='text/html' href='https://git.nea.moe/github/GT5-Unofficial.git/commit/?id=db089891a20e5696096907864578e39586035e6e'/>
<id>db089891a20e5696096907864578e39586035e6e</id>
<content type='text'>
* remove redundant suppressions

* prettify commented code

* improve comments

The integer comment contradicted the code, so I deleted it.

* delete commented-out code

* update bitwise int flip from XOR to the dedicated tilda operator

The flip was a 32-bit XOR, which is an int-flip.
That XOR was replaced with an equivalent tilda operator.

* convert a field to inline

This field was used only once, so put it straight to where it is used.

* remove fluid fix since no-one uses Forge version 1355 or earlier

* unwrap switches where fitting

In some places, we suppress IntelliJ's inspection
RedundantLabeledSwitchRuleCodeBlock - we don't want to unwrap some of
the suggested cases because we want to keep the consistency in a
switch statement for the sake of readability.

* fuse "collect" into Stream API

* fix javadocs

* remove unnecessary public modifiers from an interface

Members of an interface are public by default.

* move common parts outside of if

* suppress OverrideOnly warning in a javadoc

* remove unused lock

* suppress warnings about unchecked casts

These warnings require non-trivial fixes that are yet to arrive.
For now, let's suppress them to reduce the warning-bloat.

* remove outdated comment

* remove final modifier from private methods

Because they are private, it is hard to accidentally overwrite them.
Therefore, the final modifier is redundant in this case.

* refactor getIcon

The first 'if' doesn't cover only tMeta == 9 &amp;&amp; mConnectedMachineTextures,
therefore the second if can be unrolled.
The last switch is redundant because all tMeta values are covered by
switches, but let's keep SOLID_STEEL as a fallback just in case.

* explain what the casings are and why block casings are split

* suppress switch-to-if suggestion

* remove unnecessary null check

The null is handled in doGenerateItem()

* address redundant local variables

* rename variables in onTick

* suppress warning about accessing static member via instance

* rephrase exception

* rephrase javadoc

* address field-can-be-final warnings

* remove empty methods

* enum cannot inherit, so protected is redundant

* remove redundant throws

* update imports to be not wildcard

* remove unnecessary try-catch

* update for loop

* remove redundant code in order to use the diamond operator

* update instanceof to use pattern variables

* replace blank lines with &lt;p&gt; in javadocs

* fix dangling javadocs

* suppress warning about unreachable methods in javadocs

* remove redundant operation

* add the descriptions of parameters in javadocs

Also fix javadocs along the way.

* relax returned type in javadoc

That was done in order to make the docs reflect the code more often.
Otherwise, people may forget to change the returned type again with
another change.

* make long conversion explicit

Integer multiplication can give a wrong result if one of the parts is
not explicitly cast to long. Let's cast one of the parts where
applicable.

* remove unary plus

* simplify unary minus

* use addAll instead of forEach,add

It was suggested by IntelliJ to replace the iteration with a bulk operation
to improve performance.

* replace .asList with .singletonList for consistency

* simplify toArray calls

Explanation from IntelliJ:
There are two styles to convert a collection to an array:
* A pre-sized array, for example, c.toArray(new String[c.size()])
* An empty array, for example, c.toArray(new String[0])

In older Java versions, using a pre-sized array was recommended, as the
reflection call necessary to create an array of proper size was quite slow.
However, since late updates of OpenJDK 6, this call was intrinsified, making
the performance of the empty array version the same, and sometimes even better,
compared to the pre-sized version. Also, passing a pre-sized array is dangerous
for a concurrent or synchronized collection as a data race is possible between
the size and toArray calls. This may result in extra nulls at the end of the
array if the collection was concurrently shrunk during the operation.

* split StringBuilder append

Explanation by IntelliJ:
Reports String concatenation used as the argument to appends.
Such calls may profitably be turned into chained append calls on the existing
StringBuilder saving the cost of an extra StringBuilder allocation. This
inspection ignores compile-time evaluated String concatenations,
in which case the conversion would only worsen performance.

* annotate overriding methods with @Nonnull where needed

The method that was overridden has @Nonnull so the method that is overriding
should also have @Nonnull.

* remove set adding itself to itself

* remove null check because findField either works or blows up

cpw.mods.fml.relauncher.ReflectionHelper::findField either returns a non-null
value or throws a RuntimeException, so no need to check of null.

* remove slot comparison with tInventory.length

slot max value is 127 when tInventory.length is set to 256, which results in
that the condition is always true and unnecessary.

* remove aOutput2 null check

As GT_Values.NI is null, there is no need to check aOutput2 for null again

* suppress the suggestion to delete tMeta &lt; 13

mConnectedMachineTextures can change, so tMeta range is not guaranteed

* remove aCoverVariable % 3 &lt; 2

the if above already limits the result of % 3 to "2", so the condition
"less than 2" is always false.

* unwrap "if" because bonus is unchanged

Unwrap if because even if the bonus is a variable, it hasn't been changed for
the past 8 years and is unlikely to be changed in the future.

* reformat javadoc

* improve ignoring an exception

Make them either more clear or concise

* fixup fix typo

* update deprecated calls of newInstance()

* remove testing BaseMetaTileEntity

GregTech_API.constructBaseMetaTileEntity() checks the creation by itself,
logging and throwing a runtime error if failed.

* unwrap hatch-fill for do_SolarSalt

To reach this branch, do_coolant needs to be false and we need to still be in
the function, which means that do_SolarSalt was set to true in the previous
top-tier "if".

* remove always-false input-bus checks of MTE PlasmaForge

size() is non-negative, and the values it is compared to are final and 0.

* length and size are non-negative

Therefore, there's no need to check their negativity

* aOutput is guaranteed to be positive

* tThereWasARecipe is always false when reached in its first occurrence

* convert an assert into if

Only tStack 2 is checked for null because if it isn't null then
tStack1 also isn't null based on the "if" above.
Also IntelliJ was sure that tStack is not null for some reason.

On a side note, assertions work only either with a specified flag
or in debug runs. Therefore, it is dangerous to rely on them.

* simplify stone-gravel-cobble if

tBlock != Blocks.stone because of the if at the start of the method.
for the last else-if, tBlock == Blocks.gravel because of the check slightly
above the change.

* interDimensional is always true because of the first if

* convert an example to javadoc

* remove always-false statements

* replace referential string equality with equals

If we compare strings by "==", we compare references to them, which is not
what we usually want. I wasn't sure if String Pool works here, so I played
it save with equals().

* use Automatic Resource Management for AutoCloseable ByteBufOutputStream

* add todo to swap from sleep to event bus

* null is checked by instanceof

* merge switch branches

* add a TODO to use clamp()

* new String declaration is redundant

* use getOrDefault for a map

* replace StringBuilder with concatenation where fitting

Using a StringBuilder to concatenate two string will not make the program
faster or more understandable, so I swapped it to concatenation.

* remove unnecessary continue

* flip if

* remove redundant returns

* unwrap ifs

It's checked at the top "if" that aType == IItemRenderer.ItemRenderType.INVENTORY,
so all aType.equals(IItemRenderer.ItemRenderType.INVENTORY below are always true.

* remove checking all GT VERSIONs except the API one

* remove version check from GT_Mod and delete respective VERSION fields

Aside from GregTech_API.VERSION, these fields are not used anywhere
in the project, so only GregTech_API.VERSION was kept.

The idea and the usage check were done by miozune.</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* remove redundant suppressions

* prettify commented code

* improve comments

The integer comment contradicted the code, so I deleted it.

* delete commented-out code

* update bitwise int flip from XOR to the dedicated tilda operator

The flip was a 32-bit XOR, which is an int-flip.
That XOR was replaced with an equivalent tilda operator.

* convert a field to inline

This field was used only once, so put it straight to where it is used.

* remove fluid fix since no-one uses Forge version 1355 or earlier

* unwrap switches where fitting

In some places, we suppress IntelliJ's inspection
RedundantLabeledSwitchRuleCodeBlock - we don't want to unwrap some of
the suggested cases because we want to keep the consistency in a
switch statement for the sake of readability.

* fuse "collect" into Stream API

* fix javadocs

* remove unnecessary public modifiers from an interface

Members of an interface are public by default.

* move common parts outside of if

* suppress OverrideOnly warning in a javadoc

* remove unused lock

* suppress warnings about unchecked casts

These warnings require non-trivial fixes that are yet to arrive.
For now, let's suppress them to reduce the warning-bloat.

* remove outdated comment

* remove final modifier from private methods

Because they are private, it is hard to accidentally overwrite them.
Therefore, the final modifier is redundant in this case.

* refactor getIcon

The first 'if' doesn't cover only tMeta == 9 &amp;&amp; mConnectedMachineTextures,
therefore the second if can be unrolled.
The last switch is redundant because all tMeta values are covered by
switches, but let's keep SOLID_STEEL as a fallback just in case.

* explain what the casings are and why block casings are split

* suppress switch-to-if suggestion

* remove unnecessary null check

The null is handled in doGenerateItem()

* address redundant local variables

* rename variables in onTick

* suppress warning about accessing static member via instance

* rephrase exception

* rephrase javadoc

* address field-can-be-final warnings

* remove empty methods

* enum cannot inherit, so protected is redundant

* remove redundant throws

* update imports to be not wildcard

* remove unnecessary try-catch

* update for loop

* remove redundant code in order to use the diamond operator

* update instanceof to use pattern variables

* replace blank lines with &lt;p&gt; in javadocs

* fix dangling javadocs

* suppress warning about unreachable methods in javadocs

* remove redundant operation

* add the descriptions of parameters in javadocs

Also fix javadocs along the way.

* relax returned type in javadoc

That was done in order to make the docs reflect the code more often.
Otherwise, people may forget to change the returned type again with
another change.

* make long conversion explicit

Integer multiplication can give a wrong result if one of the parts is
not explicitly cast to long. Let's cast one of the parts where
applicable.

* remove unary plus

* simplify unary minus

* use addAll instead of forEach,add

It was suggested by IntelliJ to replace the iteration with a bulk operation
to improve performance.

* replace .asList with .singletonList for consistency

* simplify toArray calls

Explanation from IntelliJ:
There are two styles to convert a collection to an array:
* A pre-sized array, for example, c.toArray(new String[c.size()])
* An empty array, for example, c.toArray(new String[0])

In older Java versions, using a pre-sized array was recommended, as the
reflection call necessary to create an array of proper size was quite slow.
However, since late updates of OpenJDK 6, this call was intrinsified, making
the performance of the empty array version the same, and sometimes even better,
compared to the pre-sized version. Also, passing a pre-sized array is dangerous
for a concurrent or synchronized collection as a data race is possible between
the size and toArray calls. This may result in extra nulls at the end of the
array if the collection was concurrently shrunk during the operation.

* split StringBuilder append

Explanation by IntelliJ:
Reports String concatenation used as the argument to appends.
Such calls may profitably be turned into chained append calls on the existing
StringBuilder saving the cost of an extra StringBuilder allocation. This
inspection ignores compile-time evaluated String concatenations,
in which case the conversion would only worsen performance.

* annotate overriding methods with @Nonnull where needed

The method that was overridden has @Nonnull so the method that is overriding
should also have @Nonnull.

* remove set adding itself to itself

* remove null check because findField either works or blows up

cpw.mods.fml.relauncher.ReflectionHelper::findField either returns a non-null
value or throws a RuntimeException, so no need to check of null.

* remove slot comparison with tInventory.length

slot max value is 127 when tInventory.length is set to 256, which results in
that the condition is always true and unnecessary.

* remove aOutput2 null check

As GT_Values.NI is null, there is no need to check aOutput2 for null again

* suppress the suggestion to delete tMeta &lt; 13

mConnectedMachineTextures can change, so tMeta range is not guaranteed

* remove aCoverVariable % 3 &lt; 2

the if above already limits the result of % 3 to "2", so the condition
"less than 2" is always false.

* unwrap "if" because bonus is unchanged

Unwrap if because even if the bonus is a variable, it hasn't been changed for
the past 8 years and is unlikely to be changed in the future.

* reformat javadoc

* improve ignoring an exception

Make them either more clear or concise

* fixup fix typo

* update deprecated calls of newInstance()

* remove testing BaseMetaTileEntity

GregTech_API.constructBaseMetaTileEntity() checks the creation by itself,
logging and throwing a runtime error if failed.

* unwrap hatch-fill for do_SolarSalt

To reach this branch, do_coolant needs to be false and we need to still be in
the function, which means that do_SolarSalt was set to true in the previous
top-tier "if".

* remove always-false input-bus checks of MTE PlasmaForge

size() is non-negative, and the values it is compared to are final and 0.

* length and size are non-negative

Therefore, there's no need to check their negativity

* aOutput is guaranteed to be positive

* tThereWasARecipe is always false when reached in its first occurrence

* convert an assert into if

Only tStack 2 is checked for null because if it isn't null then
tStack1 also isn't null based on the "if" above.
Also IntelliJ was sure that tStack is not null for some reason.

On a side note, assertions work only either with a specified flag
or in debug runs. Therefore, it is dangerous to rely on them.

* simplify stone-gravel-cobble if

tBlock != Blocks.stone because of the if at the start of the method.
for the last else-if, tBlock == Blocks.gravel because of the check slightly
above the change.

* interDimensional is always true because of the first if

* convert an example to javadoc

* remove always-false statements

* replace referential string equality with equals

If we compare strings by "==", we compare references to them, which is not
what we usually want. I wasn't sure if String Pool works here, so I played
it save with equals().

* use Automatic Resource Management for AutoCloseable ByteBufOutputStream

* add todo to swap from sleep to event bus

* null is checked by instanceof

* merge switch branches

* add a TODO to use clamp()

* new String declaration is redundant

* use getOrDefault for a map

* replace StringBuilder with concatenation where fitting

Using a StringBuilder to concatenate two string will not make the program
faster or more understandable, so I swapped it to concatenation.

* remove unnecessary continue

* flip if

* remove redundant returns

* unwrap ifs

It's checked at the top "if" that aType == IItemRenderer.ItemRenderType.INVENTORY,
so all aType.equals(IItemRenderer.ItemRenderType.INVENTORY below are always true.

* remove checking all GT VERSIONs except the API one

* remove version check from GT_Mod and delete respective VERSION fields

Aside from GregTech_API.VERSION, these fields are not used anywhere
in the project, so only GregTech_API.VERSION was kept.

The idea and the usage check were done by miozune.</pre>
</div>
</content>
</entry>
<entry>
<title>Jabel, Generic injection and mostly automatic code cleanup (#1829)</title>
<updated>2023-04-01T19:06:12+00:00</updated>
<author>
<name>Raven Szewczyk</name>
<email>git@eigenraven.me</email>
</author>
<published>2023-04-01T19:06:12+00:00</published>
<link rel='alternate' type='text/html' href='https://git.nea.moe/github/GT5-Unofficial.git/commit/?id=b088958c9f6935d356b6c087c8e8106b400aa24f'/>
<id>b088958c9f6935d356b6c087c8e8106b400aa24f</id>
<content type='text'>
* Enable Jabel&amp;Generic injection, fix type error caused by this

* add missing &lt;&gt;

* Infer generic types automatically

* Parametrize cast types

* Use enhanced for loops

* Unnecessary boxing

* Unnecessary unboxing

* Use Objects.equals

* Explicit type can be replaced with `&lt;&gt;`

* Collapse identical catch blocks

* Add SafeVarargs where applicable

* Anonymous type can be replaced with lambda

* Use List.sort directly

* Lambda can be a method reference

* Statement lambda can be an expression lambda

* Use string switches

* Instanceof pattern matching

* Text block can be used

* Migrate to enhanced switch

* Java style array declarations

* Unnecessary toString()

* More unnecessary String conversions

* Unnecessary modifiers

* Unnecessary semicolons

* Fix duplicate conditions

* Extract common code from if branches

* Replace switches with ifs for 1-2 cases

* Inner class may be static

* Minor performance issues

* Replace string appending in loops with string builders

* Fix IntelliJ using the wrong empty list method

* Use Long.compare

* Generic arguments: getSubItems

* Generic arguments: getSubBlocks

* Raw types warnings

* Fix remaining missing generics

* Too weak variable type leads to unnecessary cast

* Redundant type casts

* Redundant array length check

* Redundant vararg arrays

* Manual min/max implementations

* A couple missed inspections

* Goodbye explosion power ternary ladder

* Apply spotless

* Get rid of the other two big ternary ladders

* Binary search explosion power

* Don't overcomplicate things</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* Enable Jabel&amp;Generic injection, fix type error caused by this

* add missing &lt;&gt;

* Infer generic types automatically

* Parametrize cast types

* Use enhanced for loops

* Unnecessary boxing

* Unnecessary unboxing

* Use Objects.equals

* Explicit type can be replaced with `&lt;&gt;`

* Collapse identical catch blocks

* Add SafeVarargs where applicable

* Anonymous type can be replaced with lambda

* Use List.sort directly

* Lambda can be a method reference

* Statement lambda can be an expression lambda

* Use string switches

* Instanceof pattern matching

* Text block can be used

* Migrate to enhanced switch

* Java style array declarations

* Unnecessary toString()

* More unnecessary String conversions

* Unnecessary modifiers

* Unnecessary semicolons

* Fix duplicate conditions

* Extract common code from if branches

* Replace switches with ifs for 1-2 cases

* Inner class may be static

* Minor performance issues

* Replace string appending in loops with string builders

* Fix IntelliJ using the wrong empty list method

* Use Long.compare

* Generic arguments: getSubItems

* Generic arguments: getSubBlocks

* Raw types warnings

* Fix remaining missing generics

* Too weak variable type leads to unnecessary cast

* Redundant type casts

* Redundant array length check

* Redundant vararg arrays

* Manual min/max implementations

* A couple missed inspections

* Goodbye explosion power ternary ladder

* Apply spotless

* Get rid of the other two big ternary ladders

* Binary search explosion power

* Don't overcomplicate things</pre>
</div>
</content>
</entry>
<entry>
<title>Add a completely new system for late/endgame content (#1754)</title>
<updated>2023-02-26T11:16:07+00:00</updated>
<author>
<name>BlueWeabo</name>
<email>ilia.iliev2005@gmail.com</email>
</author>
<published>2023-02-26T11:16:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.nea.moe/github/GT5-Unofficial.git/commit/?id=b8d1ecf8b9b6348304392d09e4490d473dbb120d'/>
<id>b8d1ecf8b9b6348304392d09e4490d473dbb120d</id>
<content type='text'>
* basic work

* typo fixes

* make an enum folder

* location enums

* space project manager

* implement the space project teams

* commands

* move things around and new things

* upgrade work

* requirement work

* if possible use an upgrades values

* cleanup

* more helpers in command

* fix AOOBE

* fix world saved data

* builder for requirements

* add command autocomplete

* fix command npe

* mark world saved data dirty

* switch to saving to json string. this is fine

* fix npe

* fix files not saving correctly. serialization

* spotless

* part 1 of fixing json saving

* working json file saving

* rename fields

* full implementation of SP_Upgrade

* fixes

* cleanup

* texture prep

* documentation part 1

* documentation part 2 and rework of json saving

* fix the missed conversions

* set texture when copying

* more interface usage and fixes

* rework saving.

* Added rudimentary NEI handler for projects

* Revert "Added rudimentary NEI handler for projects"

This reverts commit 6d8210e25b27fee7dc1865d1afa91708a8d9b875.

* address NPEs

* some textures

* higher quality textures, put in the moon as a temp texture

* add a check to create a team if one smt weird happens

* command work

* add ability to localize the space bodies

* Added disabled button and toggle button

* Added possibility to not render the original stacksize of item stacks in NEI

* Added NEI handler

* Fixes item count on tooltip always rendering as 1

* Fix refactor

* 5 new body textures

* fix misspelled texture name

---------

Co-authored-by: minecraft7771 &lt;maxim235@gmx.de&gt;</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* basic work

* typo fixes

* make an enum folder

* location enums

* space project manager

* implement the space project teams

* commands

* move things around and new things

* upgrade work

* requirement work

* if possible use an upgrades values

* cleanup

* more helpers in command

* fix AOOBE

* fix world saved data

* builder for requirements

* add command autocomplete

* fix command npe

* mark world saved data dirty

* switch to saving to json string. this is fine

* fix npe

* fix files not saving correctly. serialization

* spotless

* part 1 of fixing json saving

* working json file saving

* rename fields

* full implementation of SP_Upgrade

* fixes

* cleanup

* texture prep

* documentation part 1

* documentation part 2 and rework of json saving

* fix the missed conversions

* set texture when copying

* more interface usage and fixes

* rework saving.

* Added rudimentary NEI handler for projects

* Revert "Added rudimentary NEI handler for projects"

This reverts commit 6d8210e25b27fee7dc1865d1afa91708a8d9b875.

* address NPEs

* some textures

* higher quality textures, put in the moon as a temp texture

* add a check to create a team if one smt weird happens

* command work

* add ability to localize the space bodies

* Added disabled button and toggle button

* Added possibility to not render the original stacksize of item stacks in NEI

* Added NEI handler

* Fixes item count on tooltip always rendering as 1

* Fix refactor

* 5 new body textures

* fix misspelled texture name

---------

Co-authored-by: minecraft7771 &lt;maxim235@gmx.de&gt;</pre>
</div>
</content>
</entry>
</feed>
