Skip to content

Commit

Permalink
Merge pull request #307 from Nxer/temp
Browse files Browse the repository at this point in the history
sync from main
  • Loading branch information
Nxer authored Mar 14, 2024
2 parents bfa180b + 2a5031c commit 7594109
Show file tree
Hide file tree
Showing 21 changed files with 3,253 additions and 947 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//version: 1707058017

//
plugins {
id 'com.gtnewhorizons.gtnhconvention'
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pluginManagement {
}
}
plugins {
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.16'
id 'com.gtnewhorizons.gtnhsettingsconvention' version '1.0.19'
}
//plugins {
// id 'com.diffplug.blowdryerSetup' version '1.7.1'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

import com.Nxer.TwistSpaceTechnology.combat.items.ItemRegister;
import com.Nxer.TwistSpaceTechnology.common.crop.CropLoader;
import com.Nxer.TwistSpaceTechnology.common.machine.singleBlock.hatch.GT_Hatch_RackComputationMonitor;
import com.Nxer.TwistSpaceTechnology.config.Config;
import com.Nxer.TwistSpaceTechnology.devTools.PathHelper;
import com.Nxer.TwistSpaceTechnology.loader.MachineLoader;
Expand Down Expand Up @@ -101,6 +102,7 @@ public void preInit(FMLPreInitializationEvent event) {
public void init(FMLInitializationEvent event) {
proxy.init(event);
MachineLoader.loadMachines();// Load Machines
GT_Hatch_RackComputationMonitor.run();
NEIHandler.IMCSender();// NEI reg
// dimension provider
// *unfinished */ DimensionManager.registerProviderType(WorldStats.dimensionProviderID,
Expand All @@ -113,6 +115,7 @@ public void init(FMLInitializationEvent event) {
// postInit "Handle interaction with other mods, complete your setup based on this." (Remove if not needed)
public void postInit(FMLPostInitializationEvent event) {
proxy.postInit(event);
MachineLoader.loadMachinePostInit();
RecipeLoader.loadRecipesPostInit();// To init GTCM Recipemap

TextHandler.serializeLangMap(isInDevMode);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ public enum GTCMItemList {
HephaestusAtelier,
DeployedNanoCore,
CoreDeviceOfHumanPowerGenerationFacility,
StarcoreMiner,

// MAX
HighDimensionalExtend,
Expand Down Expand Up @@ -298,7 +299,9 @@ public enum GTCMItemList {
NuclearReactorStructure0,
NuclearReactorStructure1,
NuclearReactorStructure2,
NuclearReactorStructure3;
NuclearReactorStructure3,
FackRackHatch,
RealRackHatch;

// region Member Variables

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,21 @@
import static gregtech.api.enums.Textures.BlockIcons.casingTexturePages;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraftforge.common.util.ForgeDirection;

import com.Nxer.TwistSpaceTechnology.common.machine.multiMachineClasses.GTCM_MultiMachineBase;
import com.Nxer.TwistSpaceTechnology.util.TextLocalization;
import com.gtnewhorizon.structurelib.structure.IItemSource;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import gregtech.api.GregTech_API;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.recipe.RecipeMap;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GT_HatchElementBuilder;
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
Expand Down Expand Up @@ -105,26 +103,9 @@ public void construct(ItemStack stackSize, boolean hintsOnly) {
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, IItemSource source, EntityPlayerMP actor) {
if (this.mMachine) return -1;
int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5);
return this.survivialBuildPiece(
STRUCTURE_PIECE_MAIN,
stackSize,
horizontalOffSet,
verticalOffSet,
depthOffSet,
realBudget,
source,
actor,
false,
true);
}


@Override
public RecipeMap<?> getRecipeMap() {
return null;
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
return survivialBuildPiece(STRUCTURE_PIECE_MAIN, stackSize, horizontalOffSet, verticalOffSet, depthOffSet, elementBudget, env, false, true);
}

@Override
Expand All @@ -137,51 +118,12 @@ public final void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPla
}
}

@Override
public boolean isCorrectMachinePart(ItemStack aStack) {
return true;
}

@Override
public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack) {
// this.casingAmountActual = 0; // re-init counter
return checkPiece(STRUCTURE_PIECE_MAIN, horizontalOffSet, verticalOffSet, depthOffSet);
}

@Override
public int getMaxEfficiency(ItemStack aStack) {
return 10000;
}

@Override
public int getDamageToComponent(ItemStack aStack) {
return 0;
}

@Override
public boolean explodesOnComponentBreak(ItemStack aStack) {
return false;
}

@Override
public boolean supportsVoidProtection() {
return true;
}

@Override
public boolean supportsInputSeparation() {
return true;
}

@Override
public boolean supportsBatchMode() {
return true;
}

@Override
public boolean supportsSingleRecipeLocking() {
return true;
}

@Override
public void saveNBTData(NBTTagCompound aNBT) {
Expand Down Expand Up @@ -233,18 +175,16 @@ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirec
protected GT_Multiblock_Tooltip_Builder createTooltip() {
final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder();
tt.addMachineType("test")
.addInfo("testing")
.addSeparator()
.addInfo(TextLocalization.StructureTooComplex)
.addInfo(TextLocalization.BLUE_PRINT_INFO)
.beginStructureBlock(11, 13, 11, false)
.addController(TextLocalization.textFrontBottom)
.addCasingInfoRange(TextLocalization.textCasing, 8, 26, false)
.addInputHatch(TextLocalization.textAnyCasing, 1)
.addOutputHatch(TextLocalization.textAnyCasing, 1)
.addInputBus(TextLocalization.textAnyCasing, 2)
.addOutputBus(TextLocalization.textAnyCasing, 2)
.addMaintenanceHatch(TextLocalization.textAnyCasing, 2)
.addEnergyHatch(TextLocalization.textAnyCasing, 3)
.beginStructureBlock(3, 3, 3, false)
.addInputHatch(TextLocalization.textUseBlueprint, 1)
.addOutputHatch(TextLocalization.textUseBlueprint, 1)
.addInputBus(TextLocalization.textUseBlueprint, 2)
.addOutputBus(TextLocalization.textUseBlueprint, 2)
.addEnergyHatch(TextLocalization.textUseBlueprint, 3)
.toolTipFinisher(TextLocalization.ModName);
return tt;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.Nxer.TwistSpaceTechnology.common.machine.multiMachineClasses.GTCM_MultiMachineBase;
import com.Nxer.TwistSpaceTechnology.util.TextLocalization;
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
import com.gtnewhorizon.structurelib.structure.ISurvivalBuildEnvironment;
import com.gtnewhorizon.structurelib.structure.StructureDefinition;

import forestry.api.apiculture.EnumBeeType;
Expand Down Expand Up @@ -177,10 +178,10 @@ private void calculateTime(int size) {
// endregion

// region Structure
private final String STRUCTURE_PIECE_MAIN = "STRUCTURE_PIECE_MAIN_BE";
private static final String STRUCTURE_PIECE_MAIN = "STRUCTURE_PIECE_MAIN_BE";
private final int hOffset = 1, vOffset = 1, dOffset = 0;
private final int sCasingIndex = 10;
private static IStructureDefinition<TST_BeeEngineer> structureDef = null;
private static final int CASING_INDEX = 10;
private static IStructureDefinition<TST_BeeEngineer> STRUCTURE_DEF = null;

// spotless:off
protected final String[][] STRUCTURE = new String[][]{
Expand All @@ -192,27 +193,43 @@ private void calculateTime(int size) {

@Override
public IStructureDefinition<TST_BeeEngineer> getStructureDefinition() {
if (structureDef == null) {
structureDef = StructureDefinition.<TST_BeeEngineer>builder()
if (STRUCTURE_DEF == null) {
STRUCTURE_DEF = StructureDefinition.<TST_BeeEngineer>builder()
.addShape(STRUCTURE_PIECE_MAIN, transpose(STRUCTURE))
.addElement(
'C',
GT_HatchElementBuilder.<TST_BeeEngineer>builder()
.atLeast(InputBus, InputHatch, OutputBus)
.adder(TST_BeeEngineer::addToMachineList)
.casingIndex(sCasingIndex)
.dot(1)
.casingIndex(CASING_INDEX)
.buildAndChain(GregTech_API.sBlockCasings1, 10))
.build();
}
return structureDef;
return STRUCTURE_DEF;
}

@Override
public void construct(ItemStack stackSize, boolean hintsOnly) {
this.buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, hOffset, vOffset, dOffset);
}

@Override
public int survivalConstruct(ItemStack stackSize, int elementBudget, ISurvivalBuildEnvironment env) {
if (mMachine) return -1;
int realBudget = elementBudget >= 200 ? elementBudget : Math.min(200, elementBudget * 5);
return survivialBuildPiece(
STRUCTURE_PIECE_MAIN,
stackSize,
hOffset,
vOffset,
dOffset,
realBudget,
env,
false,
true);
}

// endregion
@Override
protected GT_Multiblock_Tooltip_Builder createTooltip() {
Expand Down Expand Up @@ -246,7 +263,7 @@ public boolean checkMachine(IGregTechTileEntity aBaseMetaTileEntity, ItemStack a
public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
int colorIndex, boolean active, boolean redstoneLevel) {
if (side == facing) {
if (active) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(sCasingIndex),
if (active) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX),
TextureFactory.builder()
.addIcon(OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE)
.extFacing()
Expand All @@ -256,7 +273,7 @@ public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirect
.extFacing()
.glow()
.build() };
return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(sCasingIndex), TextureFactory.builder()
return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX), TextureFactory.builder()
.addIcon(OVERLAY_FRONT_ASSEMBLY_LINE)
.extFacing()
.build(),
Expand All @@ -266,7 +283,7 @@ public ITexture[] getTexture(IGregTechTileEntity baseMetaTileEntity, ForgeDirect
.glow()
.build() };
}
return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(sCasingIndex) };
return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_INDEX) };
}

@Override
Expand Down
Loading

0 comments on commit 7594109

Please sign in to comment.