Skip to content

Commit

Permalink
Merge branch 'master' into yeetBioandBK
Browse files Browse the repository at this point in the history
  • Loading branch information
serenibyss authored Dec 27, 2024
2 parents 44b9af4 + 29a106c commit a27c7c4
Show file tree
Hide file tree
Showing 367 changed files with 1,499 additions and 12,212 deletions.
2 changes: 1 addition & 1 deletion dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies {
api("com.github.GTNewHorizons:ModularUI2:2.1.16-1.7.10:dev")
api("com.github.GTNewHorizons:waila:1.8.2:dev")
api("com.github.GTNewHorizons:Applied-Energistics-2-Unofficial:rv3-beta-507-GTNH:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.0-gtnh:dev")
api("com.github.GTNewHorizons:AE2FluidCraft-Rework:1.4.2-gtnh:dev")
api('com.github.GTNewHorizons:Yamcl:0.6.0:dev')
api("com.github.GTNewHorizons:Postea:1.0.13:dev")

Expand Down
2 changes: 1 addition & 1 deletion src/functionalTest/java/kubatech/test/kubatechTestMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class kubatechTestMod {
public void preInit(FMLPreInitializationEvent ev) {
// Disable GT5u messing with vanilla recipes for unit tests
GTMod.gregtechproxy.mNerfedWoodPlank = false;
GTMod.gregtechproxy.mNerfedVanillaTools = false;
GTMod.gregtechproxy.mChangeWoodenVanillaTools = false;
}

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ public boolean check(MTEWindmill t, World world, int x, int y, int z) {
return t.setRotorBlock(tileEntity);
}

@Override
public boolean couldBeValid(MTEWindmill mteWindmill, World world, int x, int y, int z, ItemStack trigger) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
return tileEntity instanceof TileEntityRotorBlock;
}

@Override
public boolean spawnHint(MTEWindmill t, World world, int x, int y, int z, ItemStack trigger) {
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ public boolean check(T o, World world, int x, int y, int z) {
return world.isAirBlock(x, y, z);
}

@Override
public boolean couldBeValid(T o, World world, int x, int y, int z, ItemStack trigger) {
return check(o, world, x, y, z);
}

@Override
public boolean spawnHint(T o, World world, int x, int y, int z, ItemStack trigger) {
if (world.blockExists(x, y, z) && !world.isAirBlock(x, y, z))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,26 +28,31 @@
import static gregtech.api.enums.OrePrefixes.plate;
import static gregtech.api.recipe.RecipeMaps.compressorRecipes;
import static gregtech.api.recipe.RecipeMaps.hammerRecipes;
import static gregtech.api.recipe.RecipeMaps.implosionRecipes;
import static gregtech.api.recipe.RecipeMaps.laserEngraverRecipes;
import static gregtech.api.recipe.RecipeMaps.latheRecipes;
import static gregtech.api.recipe.RecipeMaps.sifterRecipes;
import static gregtech.api.util.GTRecipeBuilder.MINUTES;
import static gregtech.api.util.GTRecipeBuilder.SECONDS;
import static gregtech.api.util.GTRecipeBuilder.TICKS;
import static gregtech.api.util.GTRecipeConstants.ADDITIVE_AMOUNT;

import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;

import bartworks.system.material.Werkstoff;
import bartworks.system.material.WerkstoffLoader;
import bartworks.system.material.werkstoff_loaders.IWerkstoffRunnable;
import bartworks.util.BWColorUtil;
import gregtech.api.GregTechAPI;
import gregtech.api.enums.GTValues;
import gregtech.api.enums.Materials;
import gregtech.api.enums.Textures;
import gregtech.api.enums.TierEU;
import gregtech.api.interfaces.ITexture;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTModHandler;
import gregtech.api.util.GTOreDictUnificator;
import gregtech.common.covers.CoverLens;

public class GemLoader implements IWerkstoffRunnable {
Expand Down Expand Up @@ -133,6 +138,48 @@ public void run(Werkstoff werkstoff) {
.eut(16)
.addTo(hammerRecipes);

if (!werkstoff.contains(WerkstoffLoader.NO_BLAST)) {
GTValues.RA.stdBuilder()
.itemInputs(werkstoff.get(gemFlawless, 3))
.itemOutputs(werkstoff.get(gemExquisite), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2))
.duration(20 * TICKS)
.eut(TierEU.RECIPE_LV)
.metadata(ADDITIVE_AMOUNT, 8)
.addTo(implosionRecipes);

GTValues.RA.stdBuilder()
.itemInputs(werkstoff.get(gem, 3))
.itemOutputs(werkstoff.get(gemFlawless), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2))
.duration(20 * TICKS)
.eut(TierEU.RECIPE_LV)
.metadata(ADDITIVE_AMOUNT, 8)
.addTo(implosionRecipes);

GTValues.RA.stdBuilder()
.itemInputs(werkstoff.get(gemFlawed, 3))
.itemOutputs(werkstoff.get(gem), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2))
.duration(20 * TICKS)
.eut(TierEU.RECIPE_LV)
.metadata(ADDITIVE_AMOUNT, 8)
.addTo(implosionRecipes);

GTValues.RA.stdBuilder()
.itemInputs(werkstoff.get(gemChipped, 3))
.itemOutputs(werkstoff.get(gemFlawed), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 2))
.duration(20 * TICKS)
.eut(TierEU.RECIPE_LV)
.metadata(ADDITIVE_AMOUNT, 8)
.addTo(implosionRecipes);

GTValues.RA.stdBuilder()
.itemInputs(werkstoff.get(dust, 4))
.itemOutputs(werkstoff.get(gem, 3), GTOreDictUnificator.get(dustTiny, Materials.DarkAsh, 8))
.duration(20 * TICKS)
.eut(TierEU.RECIPE_LV)
.metadata(ADDITIVE_AMOUNT, 24)
.addTo(implosionRecipes);
}

if (werkstoff.hasItemType(plate)) {

GTValues.RA.stdBuilder()
Expand Down
17 changes: 17 additions & 0 deletions src/main/java/bartworks/util/BWUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,18 @@ public boolean check(T te, World world, int x, int y, int z) {
return getter.apply(te) == glassTier;
}

@Override
public boolean couldBeValid(T te, World world, int x, int y, int z, ItemStack trigger) {
if (world.isAirBlock(x, y, z)) return false;
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);

int glassTier = GlassTier.getGlassTier(block, meta);

// If it is not a glass, the tier will be 0.
return glassTier != 0 && glassTier != notset && glassTier >= mintier && glassTier <= maxtier;
}

@Override
public boolean spawnHint(T te, World world, int x, int y, int z, ItemStack itemStack) {
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), aDots - 1);
Expand Down Expand Up @@ -340,6 +352,11 @@ public boolean check(T te, World world, int x, int y, int z) {
return glassTier >= mintier && glassTier <= maxtier;
}

@Override
public boolean couldBeValid(T te, World world, int x, int y, int z, ItemStack trigger) {
return check(te, world, x, y, z);
}

@Override
public boolean spawnHint(T te, World world, int x, int y, int z, ItemStack itemStack) {
StructureLibAPI.hintParticle(world, x, y, z, StructureLibAPI.getBlockHint(), aDots - 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static gregtech.api.enums.GTValues.V;
import static gregtech.api.enums.Textures.BlockIcons.*;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import static gregtech.api.util.GTStructureUtility.chainAllGlasses;

import java.util.Arrays;
import java.util.Collections;
Expand Down Expand Up @@ -40,7 +41,6 @@
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.metatileentity.implementations.MTEHatchInput;
import gregtech.api.metatileentity.implementations.MTEHatchOutput;
import gregtech.api.multitileentity.multiblock.casing.Glasses;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
import gregtech.api.recipe.check.CheckRecipeResultRegistry;
Expand Down Expand Up @@ -124,7 +124,7 @@ public IStructureDefinition<MTEExtremeHeatExchanger> getStructure_EM() {
.dot(5)
.build(),
onElementPass(x -> x.casingAmount++, ofBlock(GregTechAPI.sBlockCasings4, 0))))
.addElement('G', Glasses.chainAllGlasses())
.addElement('G', chainAllGlasses())
.addElement('P', ofBlock(GregTechAPI.sBlockCasings2, 15))
.addElement('W', ofBlock(Loaders.pressureResistantWalls, 0))
.build();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,29 @@
package goodgenerator.blocks.tileEntity;

import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofChain;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlocksTiered;
import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;

import java.util.ArrayList;
import java.util.List;

import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;

import org.apache.commons.lang3.tuple.Pair;
import org.jetbrains.annotations.NotNull;

import com.gtnewhorizon.structurelib.StructureLibAPI;
import com.gtnewhorizon.structurelib.alignment.constructable.IConstructable;
import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructable;
import com.gtnewhorizon.structurelib.structure.AutoPlaceEnvironment;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.IStructureElement;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.ITierConverter;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
import com.gtnewhorizon.structurelib.structure.StructureUtility;

import goodgenerator.api.recipe.GoodGeneratorRecipeMaps;
import goodgenerator.blocks.tileEntity.base.MTETooltipMultiBlockBaseEM;
Expand Down Expand Up @@ -55,7 +54,6 @@ public class MTEFuelRefineFactory extends MTETooltipMultiBlockBaseEM implements

private IStructureDefinition<MTEFuelRefineFactory> multiDefinition = null;
private int Tier = -1;
private final int[] cnt = new int[] { 0, 0, 0, 0 };
private static final Block[] coils = new Block[] { Loaders.FRF_Coil_1, Loaders.FRF_Coil_2, Loaders.FRF_Coil_3,
Loaders.FRF_Coil_4 };

Expand Down Expand Up @@ -118,64 +116,42 @@ public IStructureDefinition<MTEFuelRefineFactory> getStructure_EM() {
.addElement('G', ofBlock(Loaders.fieldRestrictingGlass, 0))
.addElement(
'F',
ofChain(
onElementPass(x -> ++x.cnt[0], ofFieldCoil(0)),
onElementPass(x -> ++x.cnt[1], ofFieldCoil(1)),
onElementPass(x -> ++x.cnt[2], ofFieldCoil(2)),
onElementPass(x -> ++x.cnt[3], ofFieldCoil(3))))
ofBlocksTiered(
fieldCoilTierConverter(),
getAllFieldCoilTiers(),
-1,
MTEFuelRefineFactory::setCoilTier,
MTEFuelRefineFactory::getCoilTier))
.build();
}
return multiDefinition;
}

public static <T> IStructureElement<T> ofFieldCoil(int aIndex) {
return new IStructureElement<>() {

@Override
public boolean check(T t, World world, int x, int y, int z) {
Block block = world.getBlock(x, y, z);
return block.equals(coils[aIndex]);
}

@Override
public boolean spawnHint(T t, World world, int x, int y, int z, ItemStack trigger) {
StructureLibAPI.hintParticle(world, x, y, z, coils[getIndex(trigger)], 0);
return true;
}

private int getIndex(ItemStack trigger) {
int s = trigger.stackSize;
if (s > 4 || s <= 0) s = 4;
return s - 1;
public static ITierConverter<Integer> fieldCoilTierConverter() {
return (block, meta) -> {
for (int i = 0; i < coils.length; i++) {
if (block.equals(coils[i])) {
return i + 1;
}
}
return null;
};
}

@Override
public boolean placeBlock(T t, World world, int x, int y, int z, ItemStack trigger) {
return world.setBlock(x, y, z, coils[getIndex(trigger)], 0, 3);
}
public static List<Pair<Block, Integer>> getAllFieldCoilTiers() {
ArrayList<Pair<Block, Integer>> tiers = new ArrayList<>();
for (Block coil : coils) {
tiers.add(Pair.of(coil, 0));
}
return tiers;
}

@Override
public BlocksToPlace getBlocksToPlace(T t, World world, int x, int y, int z, ItemStack trigger,
AutoPlaceEnvironment env) {
return BlocksToPlace.create(coils[getIndex(trigger)], 0);
}
private void setCoilTier(int tier) {
this.Tier = tier;
}

@Override
public PlaceResult survivalPlaceBlock(T t, World world, int x, int y, int z, ItemStack trigger,
AutoPlaceEnvironment env) {
if (check(t, world, x, y, z)) return PlaceResult.SKIP;
return StructureUtility.survivalPlaceBlock(
coils[getIndex(trigger)],
0,
world,
x,
y,
z,
env.getSource(),
env.getActor(),
env.getChatter());
}
};
private int getCoilTier() {
return this.Tier;
}

@Override
Expand Down Expand Up @@ -216,22 +192,8 @@ public String[] getStructureDescription(ItemStack itemStack) {

@Override
public boolean checkMachine_EM(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
cnt[0] = 0;
cnt[1] = 0;
cnt[2] = 0;
cnt[3] = 0;
return structureCheck_EM(mName, 7, 12, 1) && getTier() != -1;
}

public int getTier() {
for (int i = 0; i < 4; i++) {
if (cnt[i] == 32) {
Tier = i + 1;
return i;
}
}
Tier = -1;
return -1;
return structureCheck_EM(mName, 7, 12, 1);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import static gregtech.api.util.GTStructureUtility.chainAllGlasses;
import static gregtech.api.util.GTStructureUtility.ofFrame;

import java.util.ArrayList;
Expand Down Expand Up @@ -47,7 +48,6 @@
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.logic.ProcessingLogic;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.multitileentity.multiblock.casing.Glasses;
import gregtech.api.objects.XSTR;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.recipe.check.CheckRecipeResult;
Expand Down Expand Up @@ -229,7 +229,7 @@ public IStructureDefinition<MTENeutronActivator> getStructure_EM() {
onElementPass(MTENeutronActivator::onCasingFound, ofBlock(GregTechAPI.sBlockCasings4, 1))))
.addElement('D', ofBlock(GregTechAPI.sBlockCasings2, 6))
.addElement('F', ofFrame(Materials.Steel))
.addElement('G', Glasses.chainAllGlasses())
.addElement('G', chainAllGlasses())
.addElement('P', ofBlock(Loaders.speedingPipe, 0))
.addElement(
'X',
Expand Down
Loading

0 comments on commit a27c7c4

Please sign in to comment.