-
Notifications
You must be signed in to change notification settings - Fork 176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Miner #2170
base: master
Are you sure you want to change the base?
Miner #2170
Conversation
…ssages, it's not funny, it's rather annoying and doesn't convey any meaningful information to outsiders. Just because you don't understand what you did in last 5 days doesn't mean you are exempted from your duties of explaining your works to your collaborators. Anyways, here's a small refactor.
# Conflicts: # build.gradle # src/main/java/gregtech/client/renderer/texture/Textures.java # src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityFluidDrill.java # src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java # src/main/resources/assets/gregtech/lang/en_us.lang
@@ -314,8 +316,6 @@ public static void init() { | |||
STEAM_ROCK_BREAKER_BRONZE = registerMetaTileEntity(19, new SteamRockBreaker(gregtechId("steam_rock_breaker_bronze"), false)); | |||
STEAM_ROCK_BREAKER_STEEL = registerMetaTileEntity(20, new SteamRockBreaker(gregtechId("steam_rock_breaker_steel"), true)); | |||
|
|||
STEAM_MINER = registerMetaTileEntity(21, new SteamMiner(gregtechId("steam_miner"), 320, 4, 0)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you leave a comment saying that this ID is reserved for the steam miner addon, if you are going to use this id
src/main/java/gregtech/common/metatileentities/miner/LargeMinerTypes.java
Outdated
Show resolved
Hide resolved
|
||
@Override | ||
public boolean drainMiningResources(@Nonnull MinedBlockType minedBlockType, boolean pipeExtended, boolean simulate) { | ||
if (minedBlockType == MinedBlockType.NOTHING) return true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this mean that no energy is used in the scanning period while running a multiblock?
@@ -26,6 +26,7 @@ | |||
import gregtech.common.blocks.BlockGlassCasing; | |||
import gregtech.common.blocks.MetaBlocks; | |||
import gregtech.common.metatileentities.MetaTileEntities; | |||
import gregtech.common.metatileentities.miner.MetaTileEntityLargeMiner; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥺
# Conflicts: # src/main/java/gregtech/api/capability/GregtechDataCodes.java # src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java # src/main/java/gregtech/api/util/GTUtility.java # src/main/java/gregtech/client/ClientProxy.java # src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java # src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java # src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java # src/main/resources/assets/gregtech/lang/en_us.lang
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Large Miner GUI should remember if you were on the information or configuration screen when you last closed the screen.
Also, the mining preview seems to go all the way to bedrock, but it might be better just to render it on the level that the controller is on.
Can this PR deal with all the stuff brought up in #1751, if it is even still applicable?
Having some issues with the Buttons for Silk Touch Mode, Chunk Mode, and Repeat After Finished. I am only able to change the button display when clicking on the Repeat After Finished button, which toggles all three buttons. At other times, clicking on the other two buttons does nothing (in GUI at least)
Thoughts on having the final multiblock miner require the Assembly Line for its recipe?
this.isHighPressure ? 12 : 6, true, | ||
ConfigHolder.machines.machineSounds && !this.metaTileEntity.isMuffled())) { | ||
setNeedsVenting(false); | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this setVentingStuck
here still first check !ventingStuck
?
long resultEnergy = energyContainer.getEnergyStored() - energyToDrain; | ||
if (resultEnergy >= 0L && resultEnergy <= energyContainer.getEnergyCapacity()) { | ||
if (!simulate) { | ||
energyContainer.changeEnergy(-energyToDrain); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is energyContainer.removeEnergy
btw, if you want the additional clarity at all in the method calls
state.getBlock().getDrops(drops, world, pos, state, 0); // fallback | ||
} | ||
boolean result = GTTransferUtils.addItemsToItemHandler(inventory, true, drops); | ||
this.inventoryFull = result; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? Just because we can add something to the inventory does not mean that the inventory will necessarily be full.
int yLimit = this.minerLogic.getYLimit(); | ||
ITextComponent value; | ||
ITextComponent hoverText; | ||
if (yLimit > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs to be limited by the height of the multiblock above bedrock, or something that just prevents it from increasing forever
* @param simulate If {@code true}, this action will not affect the state of the game | ||
* @return Whether the action was successful | ||
*/ | ||
boolean drainMiningResources(@Nonnull MinedBlockType minedBlockType, boolean pipeExtended, boolean simulate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The boolean for pipeExtended
does not seem to be used in any of the implementations of this method. Was it left over from an old implementation?
# Conflicts: # src/main/java/gregtech/api/capability/IMiner.java # src/main/java/gregtech/api/capability/impl/RecipeLogicSteam.java # src/main/java/gregtech/api/capability/impl/miner/MinerLogic.java # src/main/java/gregtech/api/capability/impl/miner/MultiblockMinerLogic.java # src/main/java/gregtech/api/capability/impl/miner/SteamMinerLogic.java # src/main/java/gregtech/api/gui/GuiTextures.java # src/main/java/gregtech/api/util/BlockUtility.java # src/main/java/gregtech/api/util/GTUtility.java # src/main/java/gregtech/client/ClientProxy.java # src/main/java/gregtech/client/renderer/texture/Textures.java # src/main/java/gregtech/common/MetaEntities.java # src/main/java/gregtech/common/metatileentities/MetaTileEntities.java # src/main/java/gregtech/common/metatileentities/electric/MetaTileEntityMiner.java # src/main/java/gregtech/common/metatileentities/multi/electric/MetaTileEntityLargeMiner.java # src/main/java/gregtech/common/metatileentities/steam/SteamMiner.java # src/main/java/gregtech/common/terminal/app/prospector/widget/WidgetProspectingMap.java # src/main/java/gregtech/loaders/recipe/MetaTileEntityLoader.java
MinerUtil.DISPLAY_CLICK_CHUNK_MODE_ENABLE, MinerUtil.DISPLAY_CLICK_CHUNK_MODE_DISABLE))); | ||
|
||
textList.add(new TextComponentTranslation("gregtech.machine.miner.display.silk_touch", | ||
toggleButton(this.minerLogic.isRepeat(), this.minerLogic.isWorking(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like all the GUI buttons are passing in this.minerLogic.isRepeat()
for whether they are on or off, instead of their unique booleans.
# Conflicts: # src/main/java/gregtech/api/util/BlockUtility.java
# Conflicts: # src/main/java/gregtech/common/metatileentities/MetaTileEntities.java
What
Just a small refactor PR haha, don't worry
ok i just rewrote everything
Implementation Details
All contents of
MinerLogic
class was revisited and refactored. It now has:Among all other, the ore search algorithm is greatly improved; now the ore checking is handled by
BlockUtility#isOre
, with significantly less overhead compared to previous approach. Additionally, API for adding custom ore blockstate (or, excluding specific blockstate from ore) is available. I've migrated prospector widget to the new API.All miner implementations were revisited as well, and they feature numerous major changes both code-wise and gameplay-wise.
All miner-related classes, as well as new ones, were moved to
gregtech.common.metatileentities.miner
. Client-sided packages are located in appropriate client packages.All miners (both singleblock and multiblock) have new toggleable feature that visualizes miner's operating area in the world, accessible in UI. This feature was implemented with transitive flag, meaning the area preview will disappear once the miner gets unloaded. I don't know if this is a good idea. Also do NOT look into the rendering code, as the code in question is classified as [DATA EXPUNGED]
All miners have new UI, with more helpful information (hopefully) and less garbage internal values dumped in text panel.
Multiblock miners have three new features:
Mining pipe has been re-implemented using entities, to provide proper collision and prevent players from just falling off the pit. The new mining pipe rendering uses customizable vanilla model system, and they properly render lighting effects now.
Also the singleblock miners have new textures.
Oh. Also the steam miner is gone. Rest in peas my bro ;((
Outcome
Additional Information
There's number of implementation details and behavior changes that need to be discussed before the PR gets accepted.
The method
GTUtility#isOre
was deprecated in favor ofBlockUtility#isOre
.I'm planning to make standalone addon that adds back steam miner so anyone using it can keep the machine. I have few more ideas for the mod so I'll post about it on Discord or sth once it's done.
Potential Compatibility Issues
Existing words shouldn't blow up or anything, but the miner code is pretty much incompatible with previous one so most likely all configurations (maybe chunk mode/silktouch would be fine?) will reset and the miner will start over. Can't say much. Would appreciate if someone tests it.
A number of recipe and lang entry changes will need some work. Resource packs need to override new machine overlay for single miners.
If somebody says they're using miner code, they're not real. Don't trust a word.