Skip to content

Comments

Optical cables and Data Bank#1858

Merged
serenibyss merged 15 commits intomasterfrom
optical-cables
Jun 19, 2023
Merged

Optical cables and Data Bank#1858
serenibyss merged 15 commits intomasterfrom
optical-cables

Conversation

@TechLord22
Copy link
Member

Implements Optical Data Cables and the Data Bank Multiblock - machines to allow scaling of Research mechanics.

@TechLord22 TechLord22 added the type: feature New feature or request label Jun 19, 2023
@TechLord22 TechLord22 requested review from a team as code owners June 19, 2023 05:04
@serenibyss serenibyss merged commit 7eff7f0 into master Jun 19, 2023
@serenibyss serenibyss deleted the optical-cables branch June 19, 2023 08:05
Comment on lines +5 to +14
public class OpticalPipeProperties {

public OpticalPipeProperties() {

}

public OpticalPipeProperties(@Nonnull OpticalPipeProperties other) {

}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Yeet

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;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

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()));
Copy link
Contributor

Choose a reason for hiding this comment

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

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<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded

Comment on lines +97 to +103
public void resetTransferred() {
transferred.clear();
}

public Map<FacingPos, Integer> getTransferred() {
return transferred;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Unneeded

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();
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably also uneeded when you remove the ticking tile

MrKono added a commit to MrKono/GregTech that referenced this pull request Jun 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants