Adds Front Overlays back Fix Muffler Hatch not being allowed everywhere (multiverse) Adds Maintenance and Min Casing Requirements to all multis Add distinct mode to some multis Note: the HM crafting recipe for naq reactors has been removed, as the new assembly line recipe added applies to both NM and HM. Fixes #504 Fixes #505 Fixes #513 [EXPAND] [[messages]] messageTitle = "Improve Custom Multis" messageBody = """ [COMBINE] commits = [\"bd58b9072f45d647734ae66168cbd27bf9b2f220\"] [COMBINE] """ [[messages]] messageTitle = "Fix Custom Multis" messageBody = """ [BUG] [IGNORE] checks = { compareNot = \"1.7-alpha-1\" } [IGNORE] [DETAILS] details = [ \"Fixes Multiverse Projector Muffler Hatch Issues\", \"Fixes Naquadah Reactors\" ] [DETAILS] """ [EXPAND] [FIXUP] [[fixes]] sha = "bd58b9072f45d647734ae66168cbd27bf9b2f220" newTitle = "Update GT and Related Mods for 1.7" newBody = """ [EXPAND] [[messages]] messageTitle = \"Update GT to 2.7.4\" messageBody = \"\"\" [BREAKING] [DETAILS] details = [ \\"**Lots of Recipes have been moved to the Assembly Line, and now require Assembly Line Research.**\\", \\"Adds Assembly Line Research\\", \\"Adds ME Hatches and Buses, for combining Multiblocks with AE Networks\\", \\"Adds Filtered Output Hatches\\", \\"Adds EU Multiblock Power Storage\\", \\"Adds Multiblock Transformer and Laser Power Transfer\\", \\"Adds Long Distance Pipes\\", \\"Creating Waypoints in the Prospector\\", \\"Fixing many bugs\\", \\"And many more!\\" ] [DETAILS] \"\"\" [[messages]] messageTitle = \"Multiblock Changes\" messageBody = \"\"\" [BREAKING] [DETAILS] details = [ \\"Multiblocks accept a new **maximum** of 2 Energy Hatches.\\", \\"All Custom Multiblocks, such as Naquadah Reactors and Multiverse Projectors, now have **minimum casing requirements** and a **maintenance hatch**.\\", \\"Some Custom Multiblocks now have Distinct Mode\\", \\"All Custom Multiblocks now have custom Front Overlays\\", \\"Reworked & Improved Multiblock UIs\\" ] [DETAILS] \"\"\" [EXPAND] """ [FIXUP]
154 lines
6.8 KiB
Groovy
154 lines
6.8 KiB
Groovy
import gregtech.api.metatileentity.multiblock.FuelMultiblockController
|
|
import gregtech.api.metatileentity.MetaTileEntity
|
|
import gregtech.api.metatileentity.interfaces.IGregTechTileEntity
|
|
import gregtech.api.metatileentity.multiblock.IMultiblockPart
|
|
import gregtech.api.pattern.BlockPattern
|
|
import gregtech.api.pattern.FactoryBlockPattern
|
|
import gregtech.client.renderer.ICubeRenderer
|
|
import gregtech.common.blocks.BlockMetalCasing.MetalCasingType
|
|
import gregtech.common.blocks.MetaBlocks
|
|
import gregtech.api.recipes.RecipeMap
|
|
import net.minecraft.block.state.IBlockState
|
|
import gregicality.multiblocks.api.render.GCYMTextures
|
|
import gregtech.client.renderer.texture.Textures
|
|
import gregtech.api.metatileentity.multiblock.MultiblockAbility
|
|
import gregicality.multiblocks.common.block.GCYMMetaBlocks
|
|
import gregicality.multiblocks.common.block.blocks.BlockLargeMultiblockCasing
|
|
import gregtech.common.blocks.MetaBlocks
|
|
import gregtech.common.blocks.BlockGlassCasing
|
|
import net.minecraft.util.text.ITextComponent
|
|
import net.minecraft.util.text.Style
|
|
import net.minecraft.util.text.TextComponentTranslation
|
|
import net.minecraft.util.text.TextFormatting
|
|
import net.minecraft.util.text.event.HoverEvent
|
|
import gregtech.api.util.TextFormattingUtil
|
|
import gregtech.api.util.GTUtility
|
|
import gregtech.api.GTValues
|
|
import net.minecraft.item.ItemStack
|
|
import net.minecraft.world.World
|
|
import gregtech.client.utils.TooltipHelper
|
|
import net.minecraftforge.fml.relauncher.Side
|
|
import net.minecraftforge.fml.relauncher.SideOnly
|
|
|
|
public class NaquadahReactor extends FuelMultiblockController {
|
|
public final int numSpatial
|
|
public final IBlockState bottomFiller
|
|
public final IBlockState topFiller
|
|
public final int tier
|
|
|
|
public static final int AMP = 3
|
|
|
|
NaquadahReactor(ResourceLocation metaTileEntityId, RecipeMap recipeMap, int tier, int numSpatial, IBlockState bottomFiller, IBlockState topFiller) {
|
|
super(metaTileEntityId, recipeMap, tier)
|
|
this.tier = tier
|
|
this.numSpatial = numSpatial
|
|
this.bottomFiller = bottomFiller
|
|
this.topFiller = topFiller
|
|
this.recipeMapWorkable = new NaqRecipeLogic(this)
|
|
}
|
|
|
|
@Override
|
|
MetaTileEntity createMetaTileEntity(IGregTechTileEntity tileEntity) {
|
|
return new NaquadahReactor(metaTileEntityId, recipeMap, tier, numSpatial, bottomFiller, topFiller)
|
|
}
|
|
|
|
@Override
|
|
protected BlockPattern createStructurePattern() {
|
|
String[] aisle1 = new String[this.numSpatial + 2]
|
|
String[] aisle2 = new String[this.numSpatial + 2]
|
|
String[] aisle3 = new String[this.numSpatial + 2]
|
|
|
|
aisle1[0] = "CCC"
|
|
aisle2[0] = "CCC"
|
|
aisle3[0] = "CSC"
|
|
|
|
// Loop for numSpatial times, starting from index 1, adding spatials to outside aisles
|
|
for (int i = 1; i <= numSpatial; i++) {
|
|
aisle1[i] = "PGP"
|
|
aisle3[i] = "PGP"
|
|
}
|
|
// Loop for numSpatial - 1 times, starting from index 1, adding bottomFillers to inside aisle
|
|
for (int i = 1; i < numSpatial; i++) {
|
|
aisle2[i] = "GBG"
|
|
}
|
|
// Add top filler
|
|
aisle2[numSpatial] = "GTG"
|
|
|
|
aisle1[numSpatial + 1] = "CCC"
|
|
aisle2[numSpatial + 1] = "CCC"
|
|
aisle3[numSpatial + 1] = "CCC"
|
|
|
|
return FactoryBlockPattern.start()
|
|
.aisle(aisle1)
|
|
.aisle(aisle2)
|
|
.aisle(aisle3)
|
|
.where('S' as char, selfPredicate())
|
|
.where('G' as char, states(getGlassState()))
|
|
.where('P' as char, states(blockstate('appliedenergistics2:spatial_pylon'))) // Blockstate works here with no variants
|
|
.where('T' as char, states(this.topFiller))
|
|
.where('B' as char, states(this.bottomFiller))
|
|
.where('C' as char, states(getCasingState()).setMinGlobalLimited(10)
|
|
.or(abilities(MultiblockAbility.OUTPUT_ENERGY).setExactLimit(1))
|
|
.or(autoAbilities(false, true, true, true, false, false, false)))
|
|
.build()
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
ICubeRenderer getBaseTexture(IMultiblockPart sourcePart) {
|
|
return GCYMTextures.MIXER_CASING
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
protected ICubeRenderer getFrontOverlay() {
|
|
return Textures.FUSION_REACTOR_OVERLAY
|
|
}
|
|
|
|
/* Would use blockstate handler, but does not work with special variants and types here? */
|
|
public IBlockState getCasingState() {
|
|
return GCYMMetaBlocks.LARGE_MULTIBLOCK_CASING.getState(BlockLargeMultiblockCasing.CasingType.MIXER_CASING)
|
|
}
|
|
|
|
public IBlockState getGlassState() {
|
|
return MetaBlocks.TRANSPARENT_CASING.getState(BlockGlassCasing.CasingType.FUSION_GLASS)
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
protected void addDisplayText(List<ITextComponent> textList) {
|
|
if (!isStructureFormed()) {
|
|
ITextComponent tooltip = new TextComponentTranslation("gregtech.multiblock.invalid_structure.tooltip")
|
|
tooltip.setStyle(new Style().setColor(TextFormatting.GRAY))
|
|
textList.add(new TextComponentTranslation("gregtech.multiblock.invalid_structure")
|
|
.setStyle(new Style().setColor(TextFormatting.RED)
|
|
.setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, tooltip))))
|
|
}
|
|
else {
|
|
long produces = GTValues.V[tier] * AMP
|
|
String voltageName = GTValues.VNF[GTUtility.getFloorTierByVoltage(produces)] + TextFormatting.RESET
|
|
textList.add(new TextComponentTranslation("gregtech.multiblock.max_energy_per_tick", TextFormattingUtil.formatNumbers(produces), voltageName))
|
|
|
|
if (!recipeMapWorkable.isWorkingEnabled()) {
|
|
textList.add(new TextComponentTranslation("gregtech.multiblock.work_paused"))
|
|
} else if (recipeMapWorkable.isActive()) {
|
|
textList.add(new TextComponentTranslation("gregtech.multiblock.running"))
|
|
int currentProgress = (int) (recipeMapWorkable.getProgressPercent() * 100)
|
|
textList.add(new TextComponentTranslation("gregtech.multiblock.progress", currentProgress))
|
|
} else {
|
|
textList.add(new TextComponentTranslation("gregtech.multiblock.idling"))
|
|
}
|
|
}
|
|
}
|
|
|
|
@Override
|
|
@SideOnly(Side.CLIENT)
|
|
public void addInformation(ItemStack stack, World player, List<String> tooltip, boolean advanced) {
|
|
super.addInformation(stack, player, tooltip, advanced)
|
|
// Must not import I18n as not available on server
|
|
// Must call .toString() otherwise groovy tries to find an override for the + operator
|
|
tooltip.add(net.minecraft.client.resources.I18n.format("tooltip.contenttweaker.naquadah_reactor.produces", AMP, GTValues.VNF[tier] + TextFormatting.RESET.toString()))
|
|
tooltip.add(TooltipHelper.RAINBOW_SLOW.toString() + net.minecraft.client.resources.I18n.format("gui.contenttweaker.naquadah_reactor.overclock"))
|
|
}
|
|
}
|