aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/tileentities/machines/multi
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/gregtech/common/tileentities/machines/multi')
-rw-r--r--src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java117
1 files changed, 97 insertions, 20 deletions
diff --git a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java
index d77c6a9e53..2e0a3f9e0e 100644
--- a/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java
+++ b/src/main/java/gregtech/common/tileentities/machines/multi/MTEMultiSolidifier.java
@@ -1,9 +1,9 @@
package gregtech.common.tileentities.machines.multi;
-import static com.gtnewhorizon.structurelib.structure.StructureUtility.*;
-import static gregtech.api.enums.GTValues.AuthorFourIsTheNumber;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.ofBlock;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.onElementPass;
+import static com.gtnewhorizon.structurelib.structure.StructureUtility.transpose;
import static gregtech.api.enums.GTValues.AuthorOmdaCZ;
-import static gregtech.api.enums.GTValues.authorBaps;
import static gregtech.api.enums.HatchElement.Energy;
import static gregtech.api.enums.HatchElement.InputBus;
import static gregtech.api.enums.HatchElement.InputHatch;
@@ -18,8 +18,13 @@ import static gregtech.api.util.GTStructureUtility.buildHatchAdder;
import java.util.ArrayList;
import java.util.List;
+import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.StatCollector;
+import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidStack;
@@ -64,7 +69,10 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase<MTEMultiS
protected final String MS_RIGHT_MID = mName + "rightmid";
protected final String MS_END = mName + "end";
+ private final int PARALLELS_PER_WIDTH = 3;
+
private byte glassTier = 0;
+ private static final double decay_rate = 0.025;
private final String STRUCTURE_PIECE_MAIN = "main";
private final IStructureDefinition<MTEMultiSolidifier> STRUCTURE_DEFINITION = StructureDefinition
@@ -172,22 +180,36 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase<MTEMultiS
tt.addMachineType("Fluid Solidifier")
.addInfo("Controller Block for the Fluid Shaper")
.addInfo("Speeds up to a maximum of 300% faster than singleblock machines while running")
+ .addInfo("Decays at double the Rate that it Speeds up at")
+ .addInfo("Only uses 80% of the EU/t normally required")
.addInfo("Starts with 4 Parallels")
- .addInfo("Gain 1.5 Parallels per Width Expansion and Multiplied by Voltage Tier")
+ .addInfo("Gain " + PARALLELS_PER_WIDTH + " Parallels per Width Expansion and Multiplied by Voltage Tier")
.addInfo("Energy Hatch Based on Glass Tier, UMV Glass Unlocks all")
.addInfo(EnumChatFormatting.BLUE + "Pretty Ⱄⱁⰾⰻⰴ, isn't it")
+ .addInfo(AuthorOmdaCZ)
.addInfo(
- AuthorOmdaCZ + " with help of "
- + AuthorFourIsTheNumber
+ "With the Help Of" + " "
+ + EnumChatFormatting.LIGHT_PURPLE
+ + "Four"
+ + EnumChatFormatting.RESET
+ + ", "
+ EnumChatFormatting.AQUA
- + ", GDCloud "
- + "& "
- + authorBaps)
+ + "GDCloud"
+ + EnumChatFormatting.RESET
+ + ", "
+ + EnumChatFormatting.GOLD
+ + "Ba"
+ + EnumChatFormatting.LIGHT_PURPLE
+ + "ps"
+ + EnumChatFormatting.RESET
+ + " & "
+ + EnumChatFormatting.DARK_AQUA
+ + "TheEpicGamer274")
.addSeparator()
.beginVariableStructureBlock(17, 33, 5, 5, 5, 5, true)
.addController("Front Center bottom")
- .addCasingInfoMin("Solidifier Casing", 146, true)
- .addCasingInfoMin("Radiator Casing", 18, true)
+ .addCasingInfoMin("Solidifier Casing", 146, false)
+ .addCasingInfoMin("Radiator Casing", 18, false)
.addCasingInfoMin("Heat Proof Casing", 4, false)
.addCasingInfoMin("Solid Steel Casing", 4, false)
.addInputBus("Any Casing", 1)
@@ -203,7 +225,7 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase<MTEMultiS
public void construct(ItemStack stackSize, boolean hintsOnly) {
buildPiece(STRUCTURE_PIECE_MAIN, stackSize, hintsOnly, 3, 4, 0);
// max Width, minimal mid-pieces to build on each side
- int tTotalWidth = Math.min(6, stackSize.stackSize + 3);
+ int tTotalWidth = Math.min(stackSize.stackSize + 1, 6);
for (int i = 1; i < tTotalWidth - 1; i++) {
// horizontal offset 3 from controller and number of pieces times width of each piece
buildPiece(MS_LEFT_MID, stackSize, hintsOnly, 3 + 2 * i, 4, 0);
@@ -297,27 +319,54 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase<MTEMultiS
@NotNull
@Override
+ public CheckRecipeResult process() {
+ CheckRecipeResult check = super.process();
+ if (check == CheckRecipeResultRegistry.NO_RECIPE) speedup = 1;
+ return check;
+ }
+
+ @NotNull
+ @Override
protected CheckRecipeResult validateRecipe(@NotNull GTRecipe recipe) {
setSpeedBonus(1F / speedup);
return super.validateRecipe(recipe);
}
- }.setMaxParallelSupplier(this::getMaxParallelRecipes);
+ }.setMaxParallelSupplier(this::getMaxParallelRecipes)
+ .setEuModifier(0.8F);
}
private float speedup = 1;
+ private int tickcount = 0;
@Override
- public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
- if (aTick % 20 == 0) {
- if (this.maxProgresstime() != 0 && speedup <= 3) {
- speedup += 0.2F;
- } else speedup = 1;
+ public boolean onRunningTick(ItemStack aStack) {
+ tickcount++;
+ if (tickcount % 10 == 0 && speedup < 3) {
+ tickcount = 0;
+ speedup += 0.025F;
}
+ return super.onRunningTick(aStack);
+ }
+
+ private int tickcounts = 0;
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+
super.onPostTick(aBaseMetaTileEntity, aTick);
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (mMaxProgresstime == 0 && speedup > 1) {
+ tickcounts++;
+ if (tickcounts % 5 == 0) {
+ tickcounts = 0;
+ speedup = (float) Math.max(1, speedup - decay_rate);
+ }
+ }
+ }
}
public int getMaxParallelRecipes() {
- return 4 + (mWidth * 3 / 2) * GTUtility.getTier(this.getMaxInputVoltage());
+ return 4 + (mWidth * PARALLELS_PER_WIDTH) * GTUtility.getTier(this.getMaxInputVoltage());
}
@Override
@@ -331,9 +380,38 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase<MTEMultiS
}
@Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ super.loadNBTData(aNBT);
+ if (aNBT.hasKey("speedup")) speedup = aNBT.getFloat("speedup");
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ super.saveNBTData(aNBT);
+ aNBT.setFloat("speedup", speedup);
+ }
+
+ @Override
+ public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y,
+ int z) {
+ super.getWailaNBTData(player, tile, tag, world, x, y, z);
+ tag.setFloat("speedup", speedup);
+ tag.setInteger("parallels", getMaxParallelRecipes());
+ }
+
+ @Override
public void getWailaBody(ItemStack itemStack, List<String> currentTip, IWailaDataAccessor accessor,
IWailaConfigHandler config) {
super.getWailaBody(itemStack, currentTip, accessor, config);
+ final NBTTagCompound tag = accessor.getNBTData();
+ currentTip.add(
+ StatCollector.translateToLocal("GT5U.multiblock.speed") + ": "
+ + EnumChatFormatting.WHITE
+ + String.format("%.1f%%", 100 * tag.getFloat("speedup")));
+ currentTip.add(
+ StatCollector.translateToLocal("GT5U.multiblock.parallelism") + ": "
+ + EnumChatFormatting.WHITE
+ + tag.getInteger("parallels"));
}
@Override
@@ -366,7 +444,6 @@ public class MTEMultiSolidifier extends MTEExtendedPowerMultiBlockBase<MTEMultiS
protected CheckRecipeResult doCheckRecipe() {
CheckRecipeResult result = CheckRecipeResultRegistry.NO_RECIPE;
- // Copied all of this from LPF. Surely it works fine
// check crafting input hatches first
if (supportsCraftingMEBuffer()) {
for (IDualInputHatch dualInputHatch : mDualInputHatches) {