Skip to content

Miner Rework Repost#185

Merged
TechLord22 merged 26 commits intoGregTechCEu:masterfrom
Synthitic:portingMinersCEu
Nov 16, 2021
Merged

Miner Rework Repost#185
TechLord22 merged 26 commits intoGregTechCEu:masterfrom
Synthitic:portingMinersCEu

Conversation

@Synthitic
Copy link
Copy Markdown
Contributor

What:
This is identical to the previous PR but with Tech22's improvements since the previous PR went boom for whatever reason.
Some changes may not be detailed as they were in the comments of the previous PR. This PR also now points to master rather than the porting miner branch.

Attempts to mimic 5u miners except for mining pipes. Revamps scanning and breaking of blocks.

How solved:
Scan for blocks upon the machine receiving power, use lowest time complexity for sequential read and write that has dynamic size while sacrificing a bit of space complexity (linked list). Change scanning to scan for blocks instead of chunks then blocks. Blocks are broken under the miner per Y level and a pipe is rendered. A screwdriver can change what the radius is for the miner. The large miners have a chunk mode and silk touch mode toggle button in the machine UI. Chunk mode for the large miner means that instead of the origin being that of where the controller is, the origin is the center of the chunk the controller is in.
Overclocks for large miners are implemented like this.
Small miners no longer require drilling fluid.

Outcome:
Close to 5u miners. No longer have to waste resources on scanning for blocks.

Possible compatibility issue:
Maintenance will need to be integrated but there is a comment for implementing maintenance. Soft hammer pausing machine work also needs to be implemented. Toggle buttons in the large miner UI need textures. There are probably still a good amount of bugs to fix and optimizations to make. There are some debug values that show up in the machine UI that can be cleaned up at the end of the PR.

@TechLord22
Copy link
Copy Markdown
Member

With my commit - numerous improvements have been made.

  • Many lang file changes have been made to improve readability.
  • The steam miner can no longer adjust its radius, it's small enough to the point where it is not needed.
  • Chat messages firing at the wrong time or multiple times is now fixed for radius changes.
  • The radii for the small electric miners has been modified to to be smaller, but be the same as GT5's.
  • Some minor GUI misalignments are now fixed.
  • Miners now replace the broken blocks with cobblestone to prevent mob spawns and lighting updates to prevent potential lag.
  • Recipes have been added for the miners.
  • Unique front overlays have been added to the large miners for resourcepack authors.

Copy link
Copy Markdown
Member

@bruberu bruberu left a comment

Choose a reason for hiding this comment

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

I think this particular PR is pretty good, and this is probably ready to go, for the most part. I don't entirely understand why the algorithm is implemented the way it is, but this should be fine. I especially like that the miner enumeration is removed.

Comment thread src/main/java/gregtech/api/util/GTUtility.java Outdated
Copy link
Copy Markdown
Member

@bruberu bruberu left a comment

Choose a reason for hiding this comment

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

Soft hammering works fine on my end.

Comment thread src/main/java/gregtech/api/metatileentity/IMiner.java Outdated
Comment thread src/main/java/gregtech/api/metatileentity/IMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment thread src/main/java/gregtech/integration/jei/multiblock/infos/LargeMinerInfo.java Outdated
@TechLord22 TechLord22 requested a review from htmlcsjs November 6, 2021 21:13
Copy link
Copy Markdown
Member

@htmlcsjs htmlcsjs left a comment

Choose a reason for hiding this comment

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

looks good, jei multiblock now works

Comment thread src/main/java/gregtech/api/metatileentity/IMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment thread src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java Outdated
Comment on lines +621 to +627
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing side) {
if (capability == GregtechTileCapabilities.CAPABILITY_CONTROLLABLE) {
return GregtechTileCapabilities.CAPABILITY_CONTROLLABLE.cast(this);
}
return super.getCapability(capability, side);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is not needed. There is a check for the controllable capability inside the super.getCapability() call

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The check in the super method is for CAPABILITY_MULTIBLOCK_CONTROLLER, which is different from CAPABILITY_CONTROLLABLE.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Its in MetaTileEntity, so two classes up

Comment on lines +138 to +139
this.inputFluidInventory = new FluidTankList(false, getAbilities(MultiblockAbility.IMPORT_FLUIDS));
this.outputInventory = new ItemHandlerList(getAbilities(MultiblockAbility.EXPORT_ITEMS));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Are there notifiable versions of these that should be used? Maybe Trousers knows something

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I don't know of any notifiable ItemHandler or FluidTank List classes personally.

@TechLord22 TechLord22 merged commit 5becc9f into GregTechCEu:master Nov 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants