Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ed097b7
Implement abstract miner
bruberu Aug 18, 2021
82a3411
Port a *lot* of steam miner textures
bruberu Aug 19, 2021
924ac4f
Complete the port, onto actually fixing things!
bruberu Aug 20, 2021
2b7232e
Allow large miners to macerate their ores
bruberu Aug 20, 2021
50166a5
Create GT5U structures for the Large Miner
bruberu Aug 20, 2021
ab083cb
initial CEu port
Synthitic Sep 1, 2021
0beb331
fixes
Synthitic Sep 1, 2021
e54dd2f
crash fix + remove unnecessary LL
Synthitic Sep 1, 2021
74ed86f
implement scan throttling and other fixes
Synthitic Sep 1, 2021
e687ad6
resolve future merge conflict + other stuff
Synthitic Sep 2, 2021
8a6445a
fix maintenance implementation comment
Synthitic Sep 2, 2021
e442ddb
remove enum, fix stuff, add small ore implementation comments
Synthitic Sep 4, 2021
2237913
many general improvements
TechLord22 Oct 14, 2021
8c68fdd
steam miner recipe
TechLord22 Oct 14, 2021
81f2e0f
better range tooltips
TechLord22 Oct 15, 2021
24f60c2
add soft hammer interaction
TechLord22 Oct 15, 2021
95f8875
fix a few things
TechLord22 Oct 31, 2021
ea3c5e7
more fixes
TechLord22 Oct 31, 2021
a920615
update jei structure
TechLord22 Nov 6, 2021
91b8a9e
Merge branch 'master' into portingMinersCEu
TechLord22 Nov 6, 2021
d7e897c
get inventories correctly
TechLord22 Nov 7, 2021
67fc105
fix energy or fluid drain when full
TechLord22 Nov 7, 2021
6bdc585
large miner mode tooltips
TechLord22 Nov 7, 2021
9bc638b
more requested changes
TechLord22 Nov 16, 2021
1e7562f
changes for steam miner
TechLord22 Nov 16, 2021
275e2a1
revert multiblock miner radius switching
TechLord22 Nov 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/GTValues.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ public class GTValues {
*/
public static final long[] V = new long[]{8, 32, 128, 512, 2048, 8192, 32768, 131072, 524288, 2097152, 8388608, 33554432, 134217728, 536870912, Integer.MAX_VALUE};


/**
* The Voltage Tiers adjusted for cable loss.
*/
public static final long[] VA = new long[]{7, 30, 120, 480, 1920, 7680, 30720, 122880, 491520, 1966080, 7864320, 31457280, 125829120, 503316480, 2013265920};

public static final int ULV = 0;
public static final int LV = 1;
public static final int MV = 2;
Expand Down
8 changes: 8 additions & 0 deletions src/main/java/gregtech/api/gui/GuiTextures.java
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,21 @@ public class GuiTextures {
public static final TextureArea PRIMITIVE_BLAST_FURNACE_PROGRESS_BAR = TextureArea.fullImage("textures/gui/primitive/progress_bar_primitive_blast_furnace.png");

//BRONZE
public static final TextureArea BRONZE_DISPLAY = TextureArea.fullImage("textures/gui/steam/bronze/bronze_display.png");

public static final TextureArea BRONZE_BACKGROUND = TextureArea.fullImage("textures/gui/steam/bronze/bronze_gui.png");
public static final TextureArea BRONZE_BLAST_FURNACE_PROGRESS_BAR = TextureArea.fullImage("textures/gui/steam/bronze/progress_bar_bronze_blast_furnace.png");
public static final TextureArea BRONZE_COAL_OVERLAY = TextureArea.fullImage("textures/gui/steam/bronze/overlay_bronze_coal.png");
public static final TextureArea BRONZE_DUST_OVERLAY = TextureArea.fullImage("textures/gui/steam/bronze/overlay_bronze_dust.png");
public static final TextureArea BRONZE_FURNACE_OVERLAY = TextureArea.fullImage("textures/gui/steam/bronze/slot_bronze_furnace_background.png");
public static final TextureArea BRONZE_INGOT_OVERLAY = TextureArea.fullImage("textures/gui/steam/bronze/overlay_bronze_ingot.png");
public static final TextureArea BRONZE_SLOT = TextureArea.fullImage("textures/gui/steam/bronze/slot_bronze.png");
public static final TextureArea BRONZE_IN_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/steam/bronze/bronze_in_slot_overlay.png");
public static final TextureArea BRONZE_OUT_SLOT_OVERLAY = TextureArea.fullImage("textures/gui/steam/bronze/bronze_out_slot_overlay.png");
public static final TextureArea BRONZE_FLUID_SLOT = TextureArea.fullImage("textures/gui/steam/bronze/fluid_slot.png");
public static final TextureArea BRONZE_TANK_ICON = TextureArea.fullImage("textures/gui/steam/bronze/bronze_tank_icon.png");



//STEEL
public static final TextureArea STEEL_BACKGROUND = TextureArea.fullImage("textures/gui/steam/steel/steel_gui.png");
Expand Down
107 changes: 107 additions & 0 deletions src/main/java/gregtech/api/metatileentity/IMiner.java
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);
}
}
}
}
6 changes: 6 additions & 0 deletions src/main/java/gregtech/api/render/Textures.java
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,9 @@ public class Textures {
public static final OrientedOverlayRenderer LARGE_TITANIUM_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_titanium_boiler", FRONT);
public static final OrientedOverlayRenderer LARGE_TUNGSTENSTEEL_BOILER = new OrientedOverlayRenderer("multiblock/generator/large_tungstensteel_boiler", FRONT);
public static final OrientedOverlayRenderer FUSION_REACTOR_OVERLAY = new OrientedOverlayRenderer("machines/fusion_reactor", FRONT);
public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_BASIC = new OrientedOverlayRenderer("multiblock/large_miner_basic", FRONT);
public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED = new OrientedOverlayRenderer("multiblock/large_miner_advanced", FRONT);
public static final OrientedOverlayRenderer LARGE_MINER_OVERLAY_ADVANCED_2 = new OrientedOverlayRenderer("multiblock/large_miner_advanced_2", FRONT);
public static final OrientedOverlayRenderer ALLOY_SMELTER_OVERLAY = new OrientedOverlayRenderer("machines/alloy_smelter", FRONT);
public static final OrientedOverlayRenderer FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/furnace", FRONT);
public static final OrientedOverlayRenderer ELECTRIC_FURNACE_OVERLAY = new OrientedOverlayRenderer("machines/electric_furnace", FRONT);
Expand Down Expand Up @@ -213,6 +216,9 @@ public class Textures {
public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_FULL_AUTO = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_full_auto");
public static final SimpleOverlayRenderer MAINTENANCE_OVERLAY_CONFIGURABLE = new SimpleOverlayRenderer("overlay/machine/overlay_maintenance_configurable");
public static final SimpleOverlayRenderer MUFFLER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_muffler");
public static final SimpleOverlayRenderer STEAM_MINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_steam_miner");
public static final SimpleOverlayRenderer CHUNK_MINER_OVERLAY = new SimpleOverlayRenderer("overlay/machine/overlay_chunk_miner");
public static final SimpleOverlayRenderer BLANK_SCREEN = new SimpleOverlayRenderer("overlay/machine/overlay_blank_screen");

static {
for (int i = 0; i < VOLTAGE_CASINGS.length; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public static void register() {
Bronze = new Material.Builder(260, "bronze")
.ingot().fluid()
.color(0xFF8000).iconSet(METALLIC)
.flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_FRAME)
.flags(EXT2_METAL, MORTAR_GRINDABLE, GENERATE_ROTOR, GENERATE_FRAME, GENERATE_SMALL_GEAR)
.components(Tin, 1, Copper, 3)
.toolStats(6.0f, 2.5f, 192, 21)
.fluidPipeProperties(1696, 20, true)
Expand Down Expand Up @@ -463,7 +463,7 @@ public static void register() {
RuthenianIridium = new Material.Builder(310, "ruthenian_iridium")
.ingot(3)
.color(0xA4A4A4).iconSet(BRIGHT)
.flags(GENERATE_FINE_WIRE)
.flags(GENERATE_FINE_WIRE, GENERATE_GEAR)
.components(Ruthenium, 2, Iridium, 1)
.blastTemp(4500)
.build();
Expand Down
36 changes: 36 additions & 0 deletions src/main/java/gregtech/api/util/GTUtility.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
import gregtech.api.items.metaitem.stats.IItemBehaviour;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.MetaTileEntityHolder;
import gregtech.api.unification.OreDictUnifier;
import gregtech.api.unification.ore.OrePrefix;
import gregtech.common.ConfigHolder;
import gregtech.common.items.behaviors.CoverPlaceBehavior;
import gregtech.common.items.behaviors.CrowbarBehaviour;
Expand Down Expand Up @@ -73,6 +75,8 @@ public class GTUtility {

private static final XSTR random = new XSTR();

private static TreeMap<Integer, String> romanNumeralConversions = new TreeMap<>();

public static Runnable combine(Runnable... runnables) {
return () -> {
for (Runnable runnable : runnables) {
Expand Down Expand Up @@ -953,4 +957,36 @@ public static AxisAlignedBB rotateAroundYAxis(AxisAlignedBB aabb, EnumFacing fro
// HV+
return 64000;
};

public static String romanNumeralString(int num) {

if(romanNumeralConversions.isEmpty()) { // Initialize on first run-through.
romanNumeralConversions.put(1000, "M");
romanNumeralConversions.put(900, "CM");
romanNumeralConversions.put(500, "D");
romanNumeralConversions.put(400, "CD");
romanNumeralConversions.put(100, "C");
romanNumeralConversions.put(90, "XC");
romanNumeralConversions.put(50, "L");
romanNumeralConversions.put(40, "XL");
romanNumeralConversions.put(10, "X");
romanNumeralConversions.put(9, "IX");
romanNumeralConversions.put(5, "V");
romanNumeralConversions.put(4, "IV");
romanNumeralConversions.put(1, "I");
}

int conversion = romanNumeralConversions.floorKey(num);
if (num == conversion) {
return romanNumeralConversions.get(num);
}
return romanNumeralConversions.get(conversion) + romanNumeralString(num - conversion);
}

Comment thread
TechLord22 marked this conversation as resolved.
Outdated

public static boolean isOre(Block block) {
OrePrefix orePrefix = OreDictUnifier.getPrefix(new ItemStack(block));
return orePrefix != null && orePrefix.name().startsWith("ore");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ public class MetaTileEntities {
public static SteamAlloySmelter STEAM_ALLOY_SMELTER_STEEL;
public static SteamRockBreaker STEAM_ROCK_BREAKER_BRONZE;
public static SteamRockBreaker STEAM_ROCK_BREAKER_STEEL;
public static SteamMiner STEAM_MINER;

public static MetaTileEntityPumpHatch PUMP_OUTPUT_HATCH;
public static MetaTileEntityPrimitiveWaterPump PRIMITIVE_WATER_PUMP;
Expand Down Expand Up @@ -112,6 +113,7 @@ public class MetaTileEntities {
public static final SimpleMachineMetaTileEntity[] SCANNER = new SimpleMachineMetaTileEntity[GTValues.V.length - 1];
public static final SimpleMachineMetaTileEntity[] GAS_COLLECTOR = new MetaTileEntityGasCollector[GTValues.V.length - 1];
public static final MetaTileEntityRockBreaker[] ROCK_BREAKER = new MetaTileEntityRockBreaker[GTValues.V.length - 1];
public static final MetaTileEntityMiner[] MINER = new MetaTileEntityMiner[GTValues.V.length - 1];
public static MetaTileEntitySimpleOreWasher SIMPLE_ORE_WASHER;

//GENERATORS SECTION
Expand Down Expand Up @@ -170,6 +172,11 @@ public class MetaTileEntities {
public static MetaTileEntitySteamOven STEAM_OVEN;
public static MetaTileEntitySteamGrinder STEAM_GRINDER;

public static MetaTileEntityLargeMiner BASIC_LARGE_MINER;
public static MetaTileEntityLargeMiner LARGE_MINER;
public static MetaTileEntityLargeMiner ADVANCED_LARGE_MINER;


//STORAGE SECTION
public static MetaTileEntityLockedSafe LOCKED_SAFE;

Expand Down Expand Up @@ -246,6 +253,8 @@ 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, 16, 0));

// Electric Furnace, IDs 50-64
registerSimpleMetaTileEntity(ELECTRIC_FURNACE, 50, "electric_furnace", RecipeMaps.FURNACE_RECIPES, Textures.ELECTRIC_FURNACE_OVERLAY, true);

Expand Down Expand Up @@ -409,6 +418,13 @@ public static void init() {
// Some space here for more SimpleMachines

// Space left for these just in case

// Chunk Miner, IDs 920-934

MINER[0] = registerMetaTileEntity(920, new MetaTileEntityMiner(gregtechId("miner.lv"), 1, 160, 8, 2));
MINER[1] = registerMetaTileEntity(921, new MetaTileEntityMiner(gregtechId("miner.mv"), 2, 80, 16, 4));
MINER[2] = registerMetaTileEntity(922, new MetaTileEntityMiner(gregtechId("miner.hv"), 3, 40, 24, 6));

// Diesel Generator, IDs 935-949
COMBUSTION_GENERATOR[0] = registerMetaTileEntity(935, new SimpleGeneratorMetaTileEntity(gregtechId("combustion_generator.lv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 1));
COMBUSTION_GENERATOR[1] = registerMetaTileEntity(936, new SimpleGeneratorMetaTileEntity(gregtechId("combustion_generator.mv"), RecipeMaps.COMBUSTION_GENERATOR_FUELS, Textures.COMBUSTION_GENERATOR_OVERLAY, 2));
Expand Down Expand Up @@ -475,6 +491,10 @@ public static void init() {
STEAM_OVEN = registerMetaTileEntity(1023, new MetaTileEntitySteamOven(gregtechId("steam_oven")));
STEAM_GRINDER = registerMetaTileEntity(1024, new MetaTileEntitySteamGrinder(gregtechId("steam_grinder")));

BASIC_LARGE_MINER = registerMetaTileEntity(1025, new MetaTileEntityLargeMiner(gregtechId("large_miner.ev"), 4, Materials.Steel, 16, 3, 8, 4));
LARGE_MINER = registerMetaTileEntity(1026, new MetaTileEntityLargeMiner(gregtechId("large_miner.iv"), 5, Materials.Titanium, 4, 5, 16, 5));
ADVANCED_LARGE_MINER = registerMetaTileEntity(1027, new MetaTileEntityLargeMiner(gregtechId("large_miner.luv"), 6, Materials.TungstenSteel, 1, 7, 32, 6));

// MISC MTE's START: IDs 1150-2000

// Import/Export Buses/Hatches, IDs 1150-1209
Expand Down
Loading