Merged
Conversation
93df2b1 to
32ba507
Compare
serenibyss
approved these changes
Jun 19, 2023
brachy84
reviewed
Jun 19, 2023
Comment on lines
+5
to
+14
| public class OpticalPipeProperties { | ||
|
|
||
| public OpticalPipeProperties() { | ||
|
|
||
| } | ||
|
|
||
| public OpticalPipeProperties(@Nonnull OpticalPipeProperties other) { | ||
|
|
||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Should be changed to a singleton, since it doesnt have any fields. There should be an existing class for that if it didnt get removed at some point.
Comment on lines
+40
to
+44
| // only set pipe to ticking when something is inserted | ||
| if (tickingPipe == null) { | ||
| this.tickingPipe = (TileEntityOpticalPipeTickable) pipe.setSupportsTicking(); | ||
| this.pipe = tickingPipe; | ||
| } |
Comment on lines
+52
to
+63
| public boolean insertFirst(@Nonnull Recipe recipe, @Nonnull Collection<IDataAccessHatch> seen) { | ||
| for (OpticalPipeNet.OpticalInventory inv : net.getNetData(pipe.getPipePos(), facing)) { | ||
| IOpticalDataAccessHatch hatch = inv.getHandler(world); | ||
| if (seen.contains(hatch)) continue; | ||
| if (hatch.isTransmitter()) { | ||
| if (hatch.isRecipeAvailable(recipe, seen)) { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
| } |
Contributor
There was a problem hiding this comment.
Consider moving this code into the method above since the logic is simple.
|
|
||
| // TODO choose valid state by number of connected inventories - count does not include source tile | ||
| // if (data.size() == 1) { | ||
| data.sort(Comparator.comparingInt(inv -> inv.properties.hashCode())); |
Contributor
There was a problem hiding this comment.
No sorting needed! At least not with the current code.
| public class TileEntityOpticalPipe extends TileEntityPipeBase<OpticalPipeType, OpticalPipeProperties> { | ||
|
|
||
| private final EnumMap<EnumFacing, OpticalNetHandler> handlers = new EnumMap<>(EnumFacing.class); | ||
| private final Map<FacingPos, Integer> transferred = new HashMap<>(); |
Comment on lines
+97
to
+103
| public void resetTransferred() { | ||
| transferred.clear(); | ||
| } | ||
|
|
||
| public Map<FacingPos, Integer> getTransferred() { | ||
| return transferred; | ||
| } |
Comment on lines
+105
to
+121
| @Override | ||
| public void transferDataFrom(IPipeTile<OpticalPipeType, OpticalPipeProperties> tileEntity) { | ||
| super.transferDataFrom(tileEntity); | ||
| if (getOpticalPipeNet() == null) | ||
| return; | ||
| TileEntityOpticalPipe pipe = (TileEntityOpticalPipe) tileEntity; | ||
| if (!pipe.handlers.isEmpty() && pipe.defaultHandler != null) { | ||
| // take handlers from old pipe | ||
| handlers.clear(); | ||
| handlers.putAll(pipe.handlers); | ||
| defaultHandler = pipe.defaultHandler; | ||
| checkNetwork(); | ||
| } else { | ||
| // create new handlers | ||
| initHandlers(); | ||
| } | ||
| } |
Contributor
There was a problem hiding this comment.
Probably also uneeded when you remove the ticking tile
MrKono
added a commit
to MrKono/GregTech
that referenced
this pull request
Jun 25, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements Optical Data Cables and the Data Bank Multiblock - machines to allow scaling of Research mechanics.