Commit Graph
28 Commits
Author SHA1 Message Date
Abdiel Kavash 3b3bc4b9ad Add preset IAlignmentLimits constants. (#43)
Many multiblocks can only be placed or rotated in certain orientations.
This has been always done ad-hoc, with individual checks for each
controller. This is inconsistent and sometimes it results in bugs where
certain orientations are not allowed for no discernible reason; for
example
https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/14206.

This PR introduces a short list of named constants to
`IAlignmentLimits`, which describe common multiplboc orientations. These
are currently:

* `UNLIMITED`: Any orientation is allowed. Most multiblocks.
* `UPRIGHT`: The multiblock must be in an upright position, with the top
side facing up. Example: Distillation Tower, Ore Washing Plant.
* `NOT_UPSIDE_DOWN`: The multiblock can be in any orientation, except
for the top side facing directly downwards. This is currently only the
Large Heat Exchanger and Integrated Ore Factory.
* `FACING_UP`: The front of the controller must face up. Example:
Flotation Cell, XL Turbines.

Currently, these constants describe the allowed facings of *all* GT5U
multiblocks.

A multiblock can then simply return one of these constants from
`getInitialAlignmentLimits()` to describe its valid orientations,
instead of implementing the logic itself. This concentrates the code to
one place, improves readability, and fixes any bugs connected with these
checks being done wrong.

Of course, even though the list is currently complete, if any future
multiblock wants to implement its own strange restrictions on
orientation, it can still implement its own check instead of returning
one of the constants.

A follow-up PR to GT5U implements this for all multiblocks which
restrict valid orientations:
https://github.com/GTNewHorizons/GT5-Unofficial/pull/4595
2025-08-01 10:54:59 +07:00
Jason Mitchell e7a47c199b Enable checkstyle 2024-07-09 09:39:45 -07:00
Glease b6d2af2170 add new api to check for rotation/flip changes (#24)
* add new api to check for rotation/flip changes

Signed-off-by: Glease <[email protected]>

* add a bit javadoc

Signed-off-by: Glease <[email protected]>

---------

Signed-off-by: Glease <[email protected]>
2023-09-13 14:29:39 +02:00
Glease a8a1547845 remove unnecessary shim code for IMultiblockInfoContainer
nobody implement these in practice, so we should be safe
2023-02-28 12:37:18 +08:00
Raven Szewczyk 464e44de85 [ci skip] spotlessApply with the new settings 2023-01-30 12:52:27 +00:00
Glease 74aefd22be remove unused imports 2022-09-16 18:57:04 +08:00
Glease 72ff51d093 expose what IStructureDefinition this constructable is using 2022-09-16 18:57:04 +08:00
github-actions[bot]GleaseGitHub GTNH Actions
4fe9eb6ea5 Spotless apply for branch feature/survival-autoplace-argument-object for #13 (#14)
Co-authored-by: Glease <[email protected]>
Co-authored-by: GitHub GTNH Actions <>
2022-09-16 18:57:04 +08:00
Glease c0814274ec Use argument object for survival autoplace 2022-09-16 18:57:04 +08:00
Glease df4c54ea8d address inspections 2022-09-06 16:34:46 +08:00
Glease adc91bb1dd Add javadoc for APIs (#10) 2022-08-30 23:27:18 +08:00
Glease a12722c4b0 configurable autoplace 2022-08-23 18:56:47 +08:00
Glease b2624a3d36 unconditionally mark unsatisfied hint as red
I don't think anyone would turn this off...
2022-08-23 16:59:51 +08:00
Glease b34e901a93 channels 2022-08-23 16:55:17 +08:00
Glease c19ac860d4 fix too lenient should skip check in ofBlocksTiered 2022-08-12 21:13:32 +08:00
Glease 609e50428e Implement autoplace (#6) 2022-08-08 17:40:12 +08:00
Glease 8de7026a00 reformat project according to .editorconfig
Signed-off-by: Glease <[email protected]>
2022-07-08 17:14:18 +08:00
Glease 1f520cfd73 Add localization stuff I forgot 2021-12-22 21:17:47 +08:00
Glease 68c5436496 Add option to related to hologram projection
Also made clear what's public api and what's not.
2021-07-21 17:26:28 +08:00
Glease 4c42e5f2a2 Fix toolSetXXX not properly rotating 2021-06-16 13:46:24 +08:00
Glease 087cab652d Removed setAlignmentLimits from IAlignment
There is no reliable way to serialize the passed in IAlignmentLimit. Therefore there can't be any sort of "tool" that does this without the creator of multiblock controller being aware of what this tool will do. In that case, the programmer can just invent a private API.
It receive no usage in TecTech either way.
2021-05-29 22:59:29 +08:00
Glease 307c068db9 Add convenient methods for fast IAlignmentLimits creation 2021-05-29 19:10:15 +08:00
Glease 8975c149c0 Fix network code. Encapsulated API. 2021-05-29 19:05:50 +08:00
Glease 671da2dc1a Allow deny/allow by ExtendedFacing directly 2021-05-29 17:56:28 +08:00
Glease d7c3f9b10c Add constructable 2021-05-29 14:27:54 +08:00
Glease faf4c8d9ef Fix NPE from class initializers 2021-05-27 21:19:31 +08:00
Glease 59d311edb2 minor refactor to alignment subsystem
1. Moved package private utility methods (?!) into public API
2. Actual builder pattern
2021-05-27 18:26:05 +08:00
Glease dc12c4a1df Add most of code. Still missing some hint related stuff.
Signed-off-by: Glease <[email protected]>
2021-05-17 03:02:24 +08:00