-
Notifications
You must be signed in to change notification settings - Fork 214
Miner Rework Repost #185
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
Merged
Merged
Miner Rework Repost #185
Changes from all commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
ed097b7
Implement abstract miner
bruberu 82a3411
Port a *lot* of steam miner textures
bruberu 924ac4f
Complete the port, onto actually fixing things!
bruberu 2b7232e
Allow large miners to macerate their ores
bruberu 50166a5
Create GT5U structures for the Large Miner
bruberu ab083cb
initial CEu port
Synthitic 0beb331
fixes
Synthitic e54dd2f
crash fix + remove unnecessary LL
Synthitic 74ed86f
implement scan throttling and other fixes
Synthitic e687ad6
resolve future merge conflict + other stuff
Synthitic 8a6445a
fix maintenance implementation comment
Synthitic e442ddb
remove enum, fix stuff, add small ore implementation comments
Synthitic 2237913
many general improvements
TechLord22 8c68fdd
steam miner recipe
TechLord22 81f2e0f
better range tooltips
TechLord22 24f60c2
add soft hammer interaction
TechLord22 95f8875
fix a few things
TechLord22 ea3c5e7
more fixes
TechLord22 a920615
update jei structure
TechLord22 91b8a9e
Merge branch 'master' into portingMinersCEu
TechLord22 d7e897c
get inventories correctly
TechLord22 67fc105
fix energy or fluid drain when full
TechLord22 6bdc585
large miner mode tooltips
TechLord22 9bc638b
more requested changes
TechLord22 1e7562f
changes for steam miner
TechLord22 275e2a1
revert multiblock miner radius switching
TechLord22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| package gregtech.api.metatileentity; | ||
|
|
||
|
|
||
| import gregtech.api.recipes.MatchingMode; | ||
| import gregtech.api.recipes.Recipe; | ||
| import gregtech.api.recipes.RecipeMap; | ||
| import gregtech.api.unification.OreDictUnifier; | ||
| import gregtech.api.unification.ore.OrePrefix; | ||
| import gregtech.api.util.GTUtility; | ||
| import net.minecraft.block.Block; | ||
| import net.minecraft.block.state.IBlockState; | ||
| import net.minecraft.entity.player.EntityPlayer; | ||
| import net.minecraft.item.ItemStack; | ||
| import net.minecraft.util.math.BlockPos; | ||
| import net.minecraft.world.World; | ||
| import net.minecraftforge.common.util.FakePlayer; | ||
|
|
||
| import java.util.*; | ||
| import java.util.concurrent.atomic.AtomicInteger; | ||
|
|
||
| public interface IMiner { | ||
|
|
||
| short MAX_SPEED = Short.MAX_VALUE; | ||
|
|
||
| byte POWER = 5; | ||
|
|
||
| byte TICK_TOLERANCE = 20; | ||
|
|
||
| double DIVIDEND = MAX_SPEED * Math.pow(TICK_TOLERANCE, POWER); | ||
|
|
||
| static double GET_QUOTIENT(double base) { | ||
| return DIVIDEND / Math.pow(base, POWER); | ||
| } | ||
|
|
||
| World getWorld(); | ||
|
|
||
| long getOffsetTimer(); | ||
|
|
||
| int getTick(); | ||
|
|
||
| int getCurrentRadius(); | ||
|
|
||
| int getFortune(); | ||
|
|
||
| boolean testForMax(); | ||
|
|
||
| void initPos(); | ||
|
|
||
| static LinkedList<BlockPos> getBlocksToMine(IMiner miner, AtomicInteger x, AtomicInteger y, AtomicInteger z, AtomicInteger startX, AtomicInteger startZ, int aRadius, double tps) { | ||
| LinkedList<BlockPos> blocks = new LinkedList<>(); | ||
| int calcAmount = GET_QUOTIENT(tps) < 1 ? 1 : (int) (Math.min(GET_QUOTIENT(tps), Short.MAX_VALUE)); | ||
| for (int c = 0; c < calcAmount; ) { | ||
| if (y.get() > 0) { | ||
| if (z.get() <= startZ.get() + aRadius * 2) { | ||
| if (x.get() <= startX.get() + aRadius * 2) { | ||
| BlockPos blockPos = new BlockPos(x.get(), y.get(), z.get()); | ||
| Block block = miner.getWorld().getBlockState(blockPos).getBlock(); | ||
| if (block.blockHardness >= 0 && miner.getWorld().getTileEntity(blockPos) == null && GTUtility.isOre(block)) { | ||
| blocks.addLast(blockPos); | ||
| } | ||
| x.incrementAndGet(); | ||
| } else { | ||
| x.set(x.get() - aRadius * 2); | ||
| z.incrementAndGet(); | ||
| } | ||
| } else { | ||
| z.set(z.get() - aRadius * 2); | ||
| y.decrementAndGet(); | ||
| } | ||
| } else | ||
| return blocks; | ||
| if (!blocks.isEmpty()) | ||
| c++; | ||
| } | ||
| return blocks; | ||
| } | ||
|
|
||
| static long mean(long[] values) { | ||
| long sum = 0L; | ||
| for (long v : values) | ||
| sum += v; | ||
| return sum / values.length; | ||
| } | ||
|
|
||
| static double getMeanTickTime(World world) { | ||
| return mean(Objects.requireNonNull(world.getMinecraftServer()).tickTimeArray) * 1.0E-6D; | ||
| } | ||
|
|
||
| @SuppressWarnings({"rawtypes", "unchecked"}) | ||
| static void applyTieredHammerNoRandomDrops(Random random, IBlockState blockState, List<ItemStack> drops, int fortuneLevel, EntityPlayer player, RecipeMap map, int tier) { | ||
| ItemStack itemStack = new ItemStack(blockState.getBlock(), 1, blockState.getBlock().getMetaFromState(blockState)); | ||
| Recipe recipe = map.findRecipe(Long.MAX_VALUE, Collections.singletonList(itemStack), Collections.emptyList(), 0, MatchingMode.IGNORE_FLUIDS); | ||
| if (recipe != null && !recipe.getOutputs().isEmpty()) { | ||
| drops.clear(); | ||
| for (ItemStack outputStack : recipe.getResultItemOutputs(Integer.MAX_VALUE, random, tier)) { | ||
| outputStack = outputStack.copy(); | ||
| if (!(player instanceof FakePlayer) && OreDictUnifier.getPrefix(outputStack) == OrePrefix.crushed) { | ||
| if (fortuneLevel > 0) { | ||
| int i = Math.max(0, fortuneLevel - 1); | ||
| outputStack.grow(outputStack.getCount() * i); | ||
| } | ||
| } | ||
| drops.add(outputStack); | ||
| } | ||
| } | ||
| } | ||
| } |
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.