mirror of
https://github.com/GTNewHorizons/Electro-Magic-Tools.git
synced 2026-11-22 12:59:56 +00:00
update build script
spotless update gt dep
This commit is contained in:
107 files changed
+4980
-1920
No files matched your search
@@ -1,10 +1,12 @@
|
||||
package emt.tile;
|
||||
|
||||
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
|
||||
import static gregtech.api.enums.Textures.BlockIcons.*;
|
||||
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
|
||||
|
||||
import com.gtnewhorizon.structurelib.structure.IStructureDefinition;
|
||||
import com.gtnewhorizon.structurelib.structure.StructureDefinition;
|
||||
import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import emt.EMT;
|
||||
import emt.network.PacketNodeInfo;
|
||||
import gregtech.api.GregTech_API;
|
||||
@@ -16,6 +18,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_EnhancedMul
|
||||
import gregtech.api.render.TextureFactory;
|
||||
import gregtech.api.util.GT_Multiblock_Tooltip_Builder;
|
||||
import gregtech.api.util.GT_Utility;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -31,13 +34,8 @@ import thaumcraft.common.lib.research.ResearchManager;
|
||||
import thaumcraft.common.lib.research.ResearchNoteData;
|
||||
import thaumcraft.common.tiles.TileNode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
|
||||
import static gregtech.api.enums.Textures.BlockIcons.*;
|
||||
import static gregtech.api.util.GT_StructureUtility.ofHatchAdder;
|
||||
|
||||
public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_ResearchCompleter> {
|
||||
public class GT_MetaTileEntity_ResearchCompleter
|
||||
extends GT_MetaTileEntity_EnhancedMultiBlockBase<GT_MetaTileEntity_ResearchCompleter> {
|
||||
private static final int CASING_INDEX = 184;
|
||||
private static final int MAX_LENGTH = 13;
|
||||
private static final int RECIPE_LENGTH = 1200;
|
||||
@@ -51,7 +49,7 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
protected int mCasing;
|
||||
protected boolean endFound;
|
||||
|
||||
//For displaying beam
|
||||
// For displaying beam
|
||||
private int lastNodeDistance;
|
||||
private int lastNodeColor;
|
||||
private int syncTimer;
|
||||
@@ -60,42 +58,52 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
private static final String STRUCTURE_PIECE_LATER = "later";
|
||||
private static final String STRUCTURE_PIECE_LAST = "last";
|
||||
private static final String STRUCTURE_PIECE_LATER_HINT = "laterHint";
|
||||
private static final IStructureDefinition<GT_MetaTileEntity_ResearchCompleter> STRUCTURE_DEFINITION = StructureDefinition.<GT_MetaTileEntity_ResearchCompleter>builder()
|
||||
.addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][]{
|
||||
{"ccc"},
|
||||
{"g~g"},
|
||||
{"ccc"},
|
||||
}))
|
||||
.addShape(STRUCTURE_PIECE_LATER, transpose(new String[][]{
|
||||
{"c c"},
|
||||
{"gxg"},
|
||||
{"c c"},
|
||||
}))
|
||||
.addShape(STRUCTURE_PIECE_LAST, transpose(new String[][]{
|
||||
{"c"},
|
||||
{"g"},
|
||||
{"c"},
|
||||
}))
|
||||
.addShape(STRUCTURE_PIECE_LATER_HINT, transpose(new String[][]{
|
||||
{"c c"},
|
||||
{"g g"},
|
||||
{"c c"},
|
||||
}))
|
||||
.addElement('c', ofChain( //Magical machine casing or hatch
|
||||
ofHatchAdder(GT_MetaTileEntity_ResearchCompleter::addEnergyInputToMachineList, CASING_INDEX, 1),
|
||||
ofHatchAdder(GT_MetaTileEntity_ResearchCompleter::addInputToMachineList, CASING_INDEX, 1),
|
||||
ofHatchAdder(GT_MetaTileEntity_ResearchCompleter::addOutputToMachineList, CASING_INDEX, 1),
|
||||
ofHatchAdder(GT_MetaTileEntity_ResearchCompleter::addMaintenanceToMachineList, CASING_INDEX, 1),
|
||||
onElementPass(GT_MetaTileEntity_ResearchCompleter::onCasingFound, ofBlock(GregTech_API.sBlockCasings8, 8))
|
||||
))
|
||||
.addElement('x', ofChain( //Check for the end but otherwise treat as a skipped spot
|
||||
onElementPass(GT_MetaTileEntity_ResearchCompleter::onEndFound, ofBlock(ConfigBlocks.blockCosmeticOpaque, 2)),
|
||||
isAir(), //Forgive me
|
||||
notAir()
|
||||
))
|
||||
.addElement('g', ofBlock(ConfigBlocks.blockCosmeticOpaque, 2)) //Warded glass
|
||||
.build();
|
||||
|
||||
private static final IStructureDefinition<GT_MetaTileEntity_ResearchCompleter> STRUCTURE_DEFINITION =
|
||||
StructureDefinition.<GT_MetaTileEntity_ResearchCompleter>builder()
|
||||
.addShape(STRUCTURE_PIECE_FIRST, transpose(new String[][] {
|
||||
{"ccc"}, {"g~g"}, {"ccc"},
|
||||
}))
|
||||
.addShape(STRUCTURE_PIECE_LATER, transpose(new String[][] {
|
||||
{"c c"}, {"gxg"}, {"c c"},
|
||||
}))
|
||||
.addShape(STRUCTURE_PIECE_LAST, transpose(new String[][] {
|
||||
{"c"}, {"g"}, {"c"},
|
||||
}))
|
||||
.addShape(STRUCTURE_PIECE_LATER_HINT, transpose(new String[][] {
|
||||
{"c c"}, {"g g"}, {"c c"},
|
||||
}))
|
||||
.addElement(
|
||||
'c',
|
||||
ofChain( // Magical machine casing or hatch
|
||||
ofHatchAdder(
|
||||
GT_MetaTileEntity_ResearchCompleter::addEnergyInputToMachineList,
|
||||
CASING_INDEX,
|
||||
1),
|
||||
ofHatchAdder(
|
||||
GT_MetaTileEntity_ResearchCompleter::addInputToMachineList,
|
||||
CASING_INDEX,
|
||||
1),
|
||||
ofHatchAdder(
|
||||
GT_MetaTileEntity_ResearchCompleter::addOutputToMachineList,
|
||||
CASING_INDEX,
|
||||
1),
|
||||
ofHatchAdder(
|
||||
GT_MetaTileEntity_ResearchCompleter::addMaintenanceToMachineList,
|
||||
CASING_INDEX,
|
||||
1),
|
||||
onElementPass(
|
||||
GT_MetaTileEntity_ResearchCompleter::onCasingFound,
|
||||
ofBlock(GregTech_API.sBlockCasings8, 8))))
|
||||
.addElement(
|
||||
'x',
|
||||
ofChain( // Check for the end but otherwise treat as a skipped spot
|
||||
onElementPass(
|
||||
GT_MetaTileEntity_ResearchCompleter::onEndFound,
|
||||
ofBlock(ConfigBlocks.blockCosmeticOpaque, 2)),
|
||||
isAir(), // Forgive me
|
||||
notAir()))
|
||||
.addElement('g', ofBlock(ConfigBlocks.blockCosmeticOpaque, 2)) // Warded glass
|
||||
.build();
|
||||
|
||||
public GT_MetaTileEntity_ResearchCompleter(int aID, String aName, String aNameRegional) {
|
||||
super(aID, aName, aNameRegional);
|
||||
@@ -123,7 +131,7 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
super.loadNBTData(aNBT);
|
||||
}
|
||||
|
||||
//For client beam animation
|
||||
// For client beam animation
|
||||
public void setNodeValues(int nodeDistance, int nodeColor) {
|
||||
this.lastNodeDistance = nodeDistance;
|
||||
this.lastNodeColor = nodeColor;
|
||||
@@ -139,7 +147,19 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
double xCoord = aBaseMetaTileEntity.getXCoord() + 0.5;
|
||||
double yCoord = aBaseMetaTileEntity.getYCoord() + 0.5;
|
||||
double zCoord = aBaseMetaTileEntity.getZCoord() + 0.5;
|
||||
Thaumcraft.proxy.beam(aBaseMetaTileEntity.getWorld(), xCoord + 0.5 * xDir, yCoord + 0.5 * yDir, zCoord + 0.5 * zDir, xCoord + xDir * lastNodeDistance, yCoord + yDir * lastNodeDistance, zCoord + zDir * lastNodeDistance, 3, lastNodeColor, true, 2, 1);
|
||||
Thaumcraft.proxy.beam(
|
||||
aBaseMetaTileEntity.getWorld(),
|
||||
xCoord + 0.5 * xDir,
|
||||
yCoord + 0.5 * yDir,
|
||||
zCoord + 0.5 * zDir,
|
||||
xCoord + xDir * lastNodeDistance,
|
||||
yCoord + yDir * lastNodeDistance,
|
||||
zCoord + zDir * lastNodeDistance,
|
||||
3,
|
||||
lastNodeColor,
|
||||
true,
|
||||
2,
|
||||
1);
|
||||
} else {
|
||||
lastNodeDistance = 0;
|
||||
lastNodeColor = 0;
|
||||
@@ -152,7 +172,7 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
@Override
|
||||
public boolean onRunningTick(ItemStack aStack) {
|
||||
float progressAmount = ((float) this.mProgresstime) / this.mMaxProgresstime;
|
||||
int requiredVis = (int)Math.ceil(progressAmount * recipeAspectCost - aspectsAbsorbed);
|
||||
int requiredVis = (int) Math.ceil(progressAmount * recipeAspectCost - aspectsAbsorbed);
|
||||
syncTimer--;
|
||||
|
||||
IGregTechTileEntity aBaseMetaTileEntity = this.getBaseMetaTileEntity();
|
||||
@@ -161,7 +181,7 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
int zDir = ForgeDirection.getOrientation(aBaseMetaTileEntity.getBackFacing()).offsetZ;
|
||||
int i = 1;
|
||||
|
||||
//Loop through node spaces and drain them from front to back
|
||||
// Loop through node spaces and drain them from front to back
|
||||
while (i < this.mLength - 1 && requiredVis > 0) {
|
||||
int nodeX = aBaseMetaTileEntity.getXCoord() + xDir * i;
|
||||
int nodeY = aBaseMetaTileEntity.getYCoord() + yDir * i;
|
||||
@@ -169,7 +189,7 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
TileEntity tileEntity = aBaseMetaTileEntity.getWorld().getTileEntity(nodeX, nodeY, nodeZ);
|
||||
|
||||
if (tileEntity instanceof TileNode) {
|
||||
TileNode aNode = (TileNode)tileEntity;
|
||||
TileNode aNode = (TileNode) tileEntity;
|
||||
AspectList aspectsBase = aNode.getAspectsBase();
|
||||
|
||||
for (Aspect aspect : aspectsBase.getAspects()) {
|
||||
@@ -188,8 +208,7 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
}
|
||||
}
|
||||
|
||||
if (aspectsBase.visSize() <= 0)
|
||||
aBaseMetaTileEntity.getWorld().setBlockToAir(nodeX, nodeY, nodeZ);
|
||||
if (aspectsBase.visSize() <= 0) aBaseMetaTileEntity.getWorld().setBlockToAir(nodeX, nodeY, nodeZ);
|
||||
else {
|
||||
aNode.markDirty();
|
||||
aBaseMetaTileEntity.getWorld().markBlockForUpdate(nodeX, nodeY, nodeZ);
|
||||
@@ -198,11 +217,9 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
i++;
|
||||
}
|
||||
|
||||
if (syncTimer <= 0)
|
||||
sendClientAnimationUpdate(aBaseMetaTileEntity, lastNodeDistance, lastNodeColor);
|
||||
if (syncTimer <= 0) sendClientAnimationUpdate(aBaseMetaTileEntity, lastNodeDistance, lastNodeColor);
|
||||
|
||||
if (requiredVis > 0)
|
||||
this.criticalStopMachine();
|
||||
if (requiredVis > 0) this.criticalStopMachine();
|
||||
|
||||
return super.onRunningTick(aStack);
|
||||
}
|
||||
@@ -232,13 +249,12 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
|
||||
for (ItemStack stack : tInputList) {
|
||||
if (GT_Utility.isStackValid(stack) && stack.stackSize > 0) {
|
||||
if (stack.getItem() == ConfigItems.itemResearchNotes && !stack.stackTagCompound.getBoolean("complete")) {
|
||||
if (stack.getItem() == ConfigItems.itemResearchNotes
|
||||
&& !stack.stackTagCompound.getBoolean("complete")) {
|
||||
ResearchNoteData noteData = ResearchManager.getData(stack);
|
||||
if (noteData == null)
|
||||
continue;
|
||||
if (noteData == null) continue;
|
||||
ResearchItem researchItem = ResearchCategories.getResearch(noteData.key);
|
||||
if (researchItem == null)
|
||||
continue;
|
||||
if (researchItem == null) continue;
|
||||
|
||||
this.mEfficiency = 10000 - (this.getIdealStatus() - this.getRepairStatus()) * 1000;
|
||||
this.mEfficiencyIncrease = 10000;
|
||||
@@ -250,13 +266,13 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
this.mEUt = -this.mEUt;
|
||||
}
|
||||
|
||||
//Create a completed version of the note to output
|
||||
this.mOutputItems = new ItemStack[]{GT_Utility.copyAmount(1L, stack)};
|
||||
// Create a completed version of the note to output
|
||||
this.mOutputItems = new ItemStack[] {GT_Utility.copyAmount(1L, stack)};
|
||||
this.mOutputItems[0].stackTagCompound.setBoolean("complete", true);
|
||||
this.mOutputItems[0].setItemDamage(64);
|
||||
stack.stackSize -= 1;
|
||||
this.aspectsAbsorbed = 0;
|
||||
this.recipeAspectCost = (int)Math.ceil(researchItem.tags.visSize() * NODE_COST_MULTIPLIER);
|
||||
this.recipeAspectCost = (int) Math.ceil(researchItem.tags.visSize() * NODE_COST_MULTIPLIER);
|
||||
|
||||
this.lastNodeDistance = 0;
|
||||
this.lastNodeColor = 0;
|
||||
@@ -277,17 +293,18 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
mCasing = 0;
|
||||
endFound = false;
|
||||
|
||||
//check front
|
||||
if (!checkPiece(STRUCTURE_PIECE_FIRST, 1, 1, 0))
|
||||
return false;
|
||||
// check front
|
||||
if (!checkPiece(STRUCTURE_PIECE_FIRST, 1, 1, 0)) return false;
|
||||
|
||||
//check middle pieces
|
||||
// check middle pieces
|
||||
while (!endFound && mLength++ < MAX_LENGTH) {
|
||||
if (!checkPiece(STRUCTURE_PIECE_LATER, 1, 1, -(mLength - 1)))
|
||||
return false;
|
||||
if (!checkPiece(STRUCTURE_PIECE_LATER, 1, 1, -(mLength - 1))) return false;
|
||||
}
|
||||
|
||||
return endFound && mLength >= 3 && checkPiece(STRUCTURE_PIECE_LAST, 0, 1, -(mLength - 1)) && mCasing >= mLength * 3;
|
||||
return endFound
|
||||
&& mLength >= 3
|
||||
&& checkPiece(STRUCTURE_PIECE_LAST, 0, 1, -(mLength - 1))
|
||||
&& mCasing >= mLength * 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -324,18 +341,41 @@ public class GT_MetaTileEntity_ResearchCompleter extends GT_MetaTileEntity_Enhan
|
||||
}
|
||||
|
||||
@Override
|
||||
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
|
||||
public ITexture[] getTexture(
|
||||
IGregTechTileEntity aBaseMetaTileEntity,
|
||||
byte aSide,
|
||||
byte aFacing,
|
||||
byte aColorIndex,
|
||||
boolean aActive,
|
||||
boolean aRedstone) {
|
||||
if (aSide == aFacing) {
|
||||
if (aActive) return new ITexture[]{
|
||||
if (aActive)
|
||||
return new ITexture[] {
|
||||
Textures.BlockIcons.getCasingTextureForId(CASING_INDEX),
|
||||
TextureFactory.builder().addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER_ACTIVE).extFacing().build(),
|
||||
TextureFactory.builder().addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER_ACTIVE_GLOW).extFacing().glow().build()};
|
||||
return new ITexture[]{
|
||||
Textures.BlockIcons.getCasingTextureForId(CASING_INDEX),
|
||||
TextureFactory.builder().addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER).extFacing().build(),
|
||||
TextureFactory.builder().addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER_GLOW).extFacing().glow().build()};
|
||||
TextureFactory.builder()
|
||||
.addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER_ACTIVE)
|
||||
.extFacing()
|
||||
.build(),
|
||||
TextureFactory.builder()
|
||||
.addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER_ACTIVE_GLOW)
|
||||
.extFacing()
|
||||
.glow()
|
||||
.build()
|
||||
};
|
||||
return new ITexture[] {
|
||||
Textures.BlockIcons.getCasingTextureForId(CASING_INDEX),
|
||||
TextureFactory.builder()
|
||||
.addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER)
|
||||
.extFacing()
|
||||
.build(),
|
||||
TextureFactory.builder()
|
||||
.addIcon(OVERLAY_FRONT_RESEARCH_COMPLETER_GLOW)
|
||||
.extFacing()
|
||||
.glow()
|
||||
.build()
|
||||
};
|
||||
}
|
||||
return new ITexture[]{Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)};
|
||||
return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_INDEX)};
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user