diff options
Diffstat (limited to 'src/main/java/common/tileentities')
13 files changed, 659 insertions, 753 deletions
diff --git a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java index bd7788b768..e22ac806b6 100644 --- a/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java +++ b/src/main/java/common/tileentities/GTMTE_LapotronicSuperCapacitor.java @@ -7,6 +7,22 @@ import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static gregtech.api.util.GT_StructureUtility.filterByMTEClass; import static java.lang.Math.min; +import java.math.BigInteger; +import java.text.NumberFormat; +import java.util.*; +import java.util.function.Consumer; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti; import com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoTunnel; @@ -24,6 +40,7 @@ import com.gtnewhorizon.structurelib.structure.IStructureElement.PlaceResult; import com.gtnewhorizon.structurelib.structure.StructureUtility; import com.gtnewhorizon.structurelib.util.ItemStackPredicate.NBTMode; import common.Blocks; + import gregtech.api.enums.Dyes; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Textures.BlockIcons; @@ -37,24 +54,11 @@ import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; import gregtech.api.util.IGT_HatchAdder; -import java.math.BigInteger; -import java.text.NumberFormat; -import java.util.*; -import java.util.function.Consumer; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; public class GTMTE_LapotronicSuperCapacitor extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_LapotronicSuperCapacitor> implements IGlobalWirelessEnergy, ISurvivalConstructable { + private enum TopState { MayBeTop, Top, @@ -72,6 +76,7 @@ public class GTMTE_LapotronicSuperCapacitor private long max_passive_drain_eu_per_tick_per_uev_cap = 100_000_000; private enum Capacitor { + IV(2, BigInteger.valueOf(IV_cap_storage)), LuV(3, BigInteger.valueOf(LuV_cap_storage)), ZPM(4, BigInteger.valueOf(ZPM_cap_storage)), @@ -79,15 +84,13 @@ public class GTMTE_LapotronicSuperCapacitor UHV(6, MAX_LONG), None(0, BigInteger.ZERO), EV(1, BigInteger.valueOf(EV_cap_storage)), - UEV(7, MAX_LONG), - ; + UEV(7, MAX_LONG),; private final int minimalGlassTier; private final BigInteger providedCapacity; static final Capacitor[] VALUES = values(); static final Capacitor[] VALUES_BY_TIER = Arrays.stream(values()) - .sorted(Comparator.comparingInt(Capacitor::getMinimalGlassTier)) - .toArray(Capacitor[]::new); + .sorted(Comparator.comparingInt(Capacitor::getMinimalGlassTier)).toArray(Capacitor[]::new); Capacitor(int minimalGlassTier, BigInteger providedCapacity) { this.minimalGlassTier = minimalGlassTier; @@ -128,169 +131,128 @@ public class GTMTE_LapotronicSuperCapacitor // height channel for height. // glass channel for glass // capacitor channel for capacitor, but it really just pick whatever capacitor it can find in survival - private static final IStructureDefinition<GTMTE_LapotronicSuperCapacitor> STRUCTURE_DEFINITION = - IStructureDefinition.<GTMTE_LapotronicSuperCapacitor>builder() - .addShape(STRUCTURE_PIECE_BASE, transpose(new String[][] { - { - "bbbbb", "bbbbb", "bbbbb", "bbbbb", "bbbbb", - }, - { - "bb~bb", "bbbbb", "bbbbb", "bbbbb", "bbbbb", - }, - })) - .addShape(STRUCTURE_PIECE_LAYER, transpose(new String[][] { - { - "ggggg", "gcccg", "gcccg", "gcccg", "ggggg", - }, - })) - .addShape(STRUCTURE_PIECE_TOP, transpose(new String[][] { - { - "ggggg", "ggggg", "ggggg", "ggggg", "ggggg", - }, - })) - .addShape(STRUCTURE_PIECE_MID, transpose(new String[][] { - { - "ggggg", "gCCCg", "gCCCg", "gCCCg", "ggggg", - }, - })) - .addElement( - 'b', - buildHatchAdder(GTMTE_LapotronicSuperCapacitor.class) - .atLeast(LSCHatchElement.Energy, LSCHatchElement.Dynamo, Maintenance) - .hatchItemFilterAnd((t, h) -> ChannelDataAccessor.getChannelData(h, "glass") < 6 - ? filterByMTEClass(ImmutableList.of( + private static final IStructureDefinition<GTMTE_LapotronicSuperCapacitor> STRUCTURE_DEFINITION = IStructureDefinition + .<GTMTE_LapotronicSuperCapacitor>builder() + .addShape( + STRUCTURE_PIECE_BASE, + transpose( + new String[][] { { "bbbbb", "bbbbb", "bbbbb", "bbbbb", "bbbbb", }, + { "bb~bb", "bbbbb", "bbbbb", "bbbbb", "bbbbb", }, })) + .addShape( + STRUCTURE_PIECE_LAYER, + transpose(new String[][] { { "ggggg", "gcccg", "gcccg", "gcccg", "ggggg", }, })) + .addShape( + STRUCTURE_PIECE_TOP, + transpose(new String[][] { { "ggggg", "ggggg", "ggggg", "ggggg", "ggggg", }, })) + .addShape( + STRUCTURE_PIECE_MID, + transpose(new String[][] { { "ggggg", "gCCCg", "gCCCg", "gCCCg", "ggggg", }, })) + .addElement( + 'b', + buildHatchAdder(GTMTE_LapotronicSuperCapacitor.class) + .atLeast(LSCHatchElement.Energy, LSCHatchElement.Dynamo, Maintenance) + .hatchItemFilterAnd( + (t, h) -> ChannelDataAccessor.getChannelData(h, "glass") < 6 + ? filterByMTEClass( + ImmutableList.of( GT_MetaTileEntity_Hatch_EnergyTunnel.class, - GT_MetaTileEntity_Hatch_DynamoTunnel.class)) - .negate() + GT_MetaTileEntity_Hatch_DynamoTunnel.class)).negate() : s -> true) - .casingIndex(CASING_TEXTURE_ID) - .dot(1) - .buildAndChain( - onElementPass(te -> te.casingAmount++, ofBlock(LSC_PART, CASING_META)))) - .addElement( - 'g', - withChannel( - "glass", - BorosilicateGlass.ofBoroGlass( - (byte) GLASS_TIER_UNSET, (te, t) -> te.glassTier = t, te -> te.glassTier))) - .addElement( - 'c', - ofChain( - onlyIf( - te -> te.topState != TopState.NotTop, - onElementPass( - te -> te.topState = TopState.Top, - withChannel( - "glass", - BorosilicateGlass.ofBoroGlass( - (byte) GLASS_TIER_UNSET, - (te, t) -> te.glassTier = t, - te -> te.glassTier)))), - onlyIf( - te -> te.topState != TopState.Top, - onElementPass( - te -> te.topState = TopState.NotTop, - new IStructureElement<GTMTE_LapotronicSuperCapacitor>() { - @Override - public boolean check( - GTMTE_LapotronicSuperCapacitor t, - World world, - int x, - int y, - int z) { - Block worldBlock = world.getBlock(x, y, z); - int meta = worldBlock.getDamageValue(world, x, y, z); - if (LSC_PART != worldBlock || meta == 0) return false; - t.capacitors[meta - 1]++; - return true; - } - - private int getHint(ItemStack stack) { - return Capacitor.VALUES_BY_TIER[ - Math.min( - Capacitor.VALUES_BY_TIER - .length, - ChannelDataAccessor - .getChannelData( - stack, - "capacitor")) - - 1] - .getMinimalGlassTier() - + 1; - } - - @Override - public boolean spawnHint( - GTMTE_LapotronicSuperCapacitor t, - World world, - int x, - int y, - int z, - ItemStack trigger) { - StructureLibAPI.hintParticle( - world, x, y, z, LSC_PART, getHint(trigger)); - return true; - } - - @Override - public boolean placeBlock( - GTMTE_LapotronicSuperCapacitor t, - World world, - int x, - int y, - int z, - ItemStack trigger) { - world.setBlock(x, y, z, LSC_PART, getHint(trigger), 3); - return true; - } - - @Override - public PlaceResult survivalPlaceBlock( - GTMTE_LapotronicSuperCapacitor t, - World world, - int x, - int y, - int z, - ItemStack trigger, - IItemSource source, - EntityPlayerMP actor, - Consumer<IChatComponent> chatter) { - if (check(t, world, x, y, z)) return PlaceResult.SKIP; - int glassTier = - ChannelDataAccessor.getChannelData(trigger, "glass") - + 2; - ItemStack targetStack = source.takeOne( - s -> s != null - && s.stackSize >= 0 - && s.getItem() == LSC_PART_ITEM - && Capacitor.VALUES[ - Math.min( - s - .getItemDamage(), - Capacitor - .VALUES - .length) - - 1] - .getMinimalGlassTier() - > glassTier, - true); - if (targetStack == null) return PlaceResult.REJECT; - return StructureUtility.survivalPlaceBlock( - targetStack, - NBTMode.EXACT, - targetStack.stackTagCompound, - true, - world, - x, - y, - z, - source, - actor, - chatter); - } - })))) - .addElement('C', ofBlock(LSC_PART, 1)) - .build(); + .casingIndex(CASING_TEXTURE_ID).dot(1) + .buildAndChain(onElementPass(te -> te.casingAmount++, ofBlock(LSC_PART, CASING_META)))) + .addElement( + 'g', + withChannel( + "glass", + BorosilicateGlass.ofBoroGlass( + (byte) GLASS_TIER_UNSET, + (te, t) -> te.glassTier = t, + te -> te.glassTier))) + .addElement( + 'c', + ofChain( + onlyIf( + te -> te.topState != TopState.NotTop, + onElementPass( + te -> te.topState = TopState.Top, + withChannel( + "glass", + BorosilicateGlass.ofBoroGlass( + (byte) GLASS_TIER_UNSET, + (te, t) -> te.glassTier = t, + te -> te.glassTier)))), + onlyIf( + te -> te.topState != TopState.Top, + onElementPass( + te -> te.topState = TopState.NotTop, + new IStructureElement<GTMTE_LapotronicSuperCapacitor>() { + + @Override + public boolean check(GTMTE_LapotronicSuperCapacitor t, World world, + int x, int y, int z) { + Block worldBlock = world.getBlock(x, y, z); + int meta = worldBlock.getDamageValue(world, x, y, z); + if (LSC_PART != worldBlock || meta == 0) return false; + t.capacitors[meta - 1]++; + return true; + } + + private int getHint(ItemStack stack) { + return Capacitor.VALUES_BY_TIER[Math.min( + Capacitor.VALUES_BY_TIER.length, + ChannelDataAccessor.getChannelData(stack, "capacitor")) - 1] + .getMinimalGlassTier() + + 1; + } + + @Override + public boolean spawnHint(GTMTE_LapotronicSuperCapacitor t, World world, + int x, int y, int z, ItemStack trigger) { + StructureLibAPI + .hintParticle(world, x, y, z, LSC_PART, getHint(trigger)); + return true; + } + + @Override + public boolean placeBlock(GTMTE_LapotronicSuperCapacitor t, World world, + int x, int y, int z, ItemStack trigger) { + world.setBlock(x, y, z, LSC_PART, getHint(trigger), 3); + return true; + } + + @Override + public PlaceResult survivalPlaceBlock(GTMTE_LapotronicSuperCapacitor t, + World world, int x, int y, int z, ItemStack trigger, + IItemSource source, EntityPlayerMP actor, + Consumer<IChatComponent> chatter) { + if (check(t, world, x, y, z)) return PlaceResult.SKIP; + int glassTier = ChannelDataAccessor.getChannelData(trigger, "glass") + + 2; + ItemStack targetStack = source.takeOne( + s -> s != null && s.stackSize >= 0 + && s.getItem() == LSC_PART_ITEM + && Capacitor.VALUES[Math.min( + s.getItemDamage(), + Capacitor.VALUES.length) - 1] + .getMinimalGlassTier() + > glassTier, + true); + if (targetStack == null) return PlaceResult.REJECT; + return StructureUtility.survivalPlaceBlock( + targetStack, + NBTMode.EXACT, + targetStack.stackTagCompound, + true, + world, + x, + y, + z, + source, + actor, + chatter); + } + })))) + .addElement('C', ofBlock(LSC_PART, 1)).build(); private static final BigInteger MAX_LONG = BigInteger.valueOf(Long.MAX_VALUE); @@ -299,8 +261,7 @@ public class GTMTE_LapotronicSuperCapacitor private final Set<GT_MetaTileEntity_Hatch_EnergyTunnel> mEnergyTunnelsTT = new HashSet<>(); private final Set<GT_MetaTileEntity_Hatch_DynamoTunnel> mDynamoTunnelsTT = new HashSet<>(); /** - * Count the amount of capacitors of each tier in each slot. - * Index = meta - 1 + * Count the amount of capacitors of each tier in each slot. Index = meta - 1 */ private final int[] capacitors = new int[8]; @@ -357,8 +318,8 @@ public class GTMTE_LapotronicSuperCapacitor if (!(aMetaTileEntity instanceof GT_MetaTileEntity_Hatch)) return false; if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Maintenance) { ((GT_MetaTileEntity_Hatch) aMetaTileEntity).updateTexture(aBaseCasingIndex); - return GTMTE_LapotronicSuperCapacitor.this.mMaintenanceHatches.add( - (GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); + return GTMTE_LapotronicSuperCapacitor.this.mMaintenanceHatches + .add((GT_MetaTileEntity_Hatch_Maintenance) aMetaTileEntity); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_Energy) { // Add GT hatches final GT_MetaTileEntity_Hatch_Energy tHatch = ((GT_MetaTileEntity_Hatch_Energy) aMetaTileEntity); @@ -366,8 +327,7 @@ public class GTMTE_LapotronicSuperCapacitor return mEnergyHatches.add(tHatch); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyTunnel) { // Add TT Laser hatches - final GT_MetaTileEntity_Hatch_EnergyTunnel tHatch = - ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity); + final GT_MetaTileEntity_Hatch_EnergyTunnel tHatch = ((GT_MetaTileEntity_Hatch_EnergyTunnel) aMetaTileEntity); processInputHatch(tHatch, aBaseCasingIndex); return mEnergyTunnelsTT.add(tHatch); } else if (aMetaTileEntity instanceof GT_MetaTileEntity_Hatch_EnergyMulti) { @@ -405,85 +365,121 @@ public class GTMTE_LapotronicSuperCapacitor @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Energy Storage") - .addInfo("Loses energy equal to 1% of the total capacity every 24 hours.") - .addInfo("Capped at " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + EnumChatFormatting.GRAY - + " EU/t passive loss per " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + " capacitor and ") - .addInfo(EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uev_cap) - + EnumChatFormatting.GRAY + " EU/t passive loss per " + GT_Values.TIER_COLORS[10] - + GT_Values.VN[10] + EnumChatFormatting.GRAY + " capacitor.") - .addInfo("Passive loss is multiplied by the number of maintenance issues present.") - .addSeparator() + tt.addMachineType("Energy Storage").addInfo("Loses energy equal to 1% of the total capacity every 24 hours.") + .addInfo( + "Capped at " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uhv_cap) + + EnumChatFormatting.GRAY + + " EU/t passive loss per " + + GT_Values.TIER_COLORS[9] + + GT_Values.VN[9] + + EnumChatFormatting.GRAY + + " capacitor and ") + .addInfo( + EnumChatFormatting.RED + GT_Utility.formatNumbers(max_passive_drain_eu_per_tick_per_uev_cap) + + EnumChatFormatting.GRAY + + " EU/t passive loss per " + + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + + EnumChatFormatting.GRAY + + " capacitor.") + .addInfo("Passive loss is multiplied by the number of maintenance issues present.").addSeparator() .addInfo("Glass shell has to be Tier - 3 of the highest capacitor tier.") - .addInfo(GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY - + "-tier glass required for " + EnumChatFormatting.BLUE + "Tec" + EnumChatFormatting.DARK_BLUE - + "Tech" + EnumChatFormatting.GRAY + " Laser Hatches.") - .addInfo("Add more or better capacitors to increase capacity.") - .addSeparator() + .addInfo( + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + + EnumChatFormatting.GRAY + + "-tier glass required for " + + EnumChatFormatting.BLUE + + "Tec" + + EnumChatFormatting.DARK_BLUE + + "Tech" + + EnumChatFormatting.GRAY + + " Laser Hatches.") + .addInfo("Add more or better capacitors to increase capacity.").addSeparator() .addInfo("Wireless mode can be enabled by right clicking with a screwdriver.") - .addInfo("This mode can only be enabled if you have a " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] - + EnumChatFormatting.GRAY + " capacitor in the multiblock.") - .addInfo("When enabled every " + EnumChatFormatting.BLUE - + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) - + EnumChatFormatting.GRAY + " ticks the LSC will attempt to re-balance against your") + .addInfo( + "This mode can only be enabled if you have a " + GT_Values.TIER_COLORS[9] + + GT_Values.VN[9] + + EnumChatFormatting.GRAY + + " or " + + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + + EnumChatFormatting.GRAY + + " capacitor in the multiblock.") + .addInfo( + "When enabled every " + EnumChatFormatting.BLUE + + GT_Utility.formatNumbers(LSC_time_between_wireless_rebalance_in_ticks) + + EnumChatFormatting.GRAY + + " ticks the LSC will attempt to re-balance against your") .addInfo("wireless EU network.") - .addInfo("If there is less than " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + EnumChatFormatting.GRAY + "(" - + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.GRAY + ")" + " or " - + EnumChatFormatting.RED + GT_Utility.formatNumbers(UEV_wireless_eu_cap) - + EnumChatFormatting.GRAY + "(" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] - + EnumChatFormatting.GRAY + ")" + " EU in the LSC") + .addInfo( + "If there is less than " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(LSC_wireless_eu_cap) + + EnumChatFormatting.GRAY + + "(" + + GT_Values.TIER_COLORS[9] + + GT_Values.VN[9] + + EnumChatFormatting.GRAY + + ")" + + " or " + + EnumChatFormatting.RED + + GT_Utility.formatNumbers(UEV_wireless_eu_cap) + + EnumChatFormatting.GRAY + + "(" + + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + + EnumChatFormatting.GRAY + + ")" + + " EU in the LSC") .addInfo("it will withdraw from the network and add to the LSC. If there is more it will add") - .addInfo("the EU to the network and remove it from the LSC.") - .addSeparator() + .addInfo("the EU to the network and remove it from the LSC.").addSeparator() .beginVariableStructureBlock(5, 5, 4, 50, 5, 5, false) - .addStructureInfo("Modular height of 4-50 blocks.") - .addController("Front center bottom") + .addStructureInfo("Modular height of 4-50 blocks.").addController("Front center bottom") .addOtherStructurePart("Lapotronic Super Capacitor Casing", "5x2x5 base (at least 17x)") .addOtherStructurePart( - "Lapotronic Capacitor (" + GT_Values.TIER_COLORS[4] + GT_Values.VN[4] + EnumChatFormatting.GRAY - + "-" + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] + EnumChatFormatting.GRAY - + "), Ultimate Capacitor (" + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.GRAY + "-" + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] - + EnumChatFormatting.GRAY + ")", + "Lapotronic Capacitor (" + GT_Values.TIER_COLORS[4] + + GT_Values.VN[4] + + EnumChatFormatting.GRAY + + "-" + + GT_Values.TIER_COLORS[8] + + GT_Values.VN[8] + + EnumChatFormatting.GRAY + + "), Ultimate Capacitor (" + + GT_Values.TIER_COLORS[9] + + GT_Values.VN[9] + + EnumChatFormatting.GRAY + + "-" + + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + + EnumChatFormatting.GRAY + + ")", "Center 3x(1-47)x3 above base (9-423 blocks)") .addStructureInfo( "You can also use the Empty Capacitor to save materials if you use it for less than half the blocks") .addOtherStructurePart("Borosilicate Glass (any)", "41-265x, Encase capacitor pillar") - .addEnergyHatch("Any casing") - .addDynamoHatch("Any casing") + .addEnergyHatch("Any casing").addDynamoHatch("Any casing") .addOtherStructurePart( "Laser Target/Source Hatches", - "Any casing, must be using " + GT_Values.TIER_COLORS[8] + GT_Values.VN[8] - + EnumChatFormatting.GRAY + "-tier glass") + "Any casing, must be using " + GT_Values.TIER_COLORS[8] + + GT_Values.VN[8] + + EnumChatFormatting.GRAY + + "-tier glass") .addStructureInfo("You can have several I/O Hatches") .addSubChannelUsage("glass", "Borosilicate Glass Tier") .addSubChannelUsage("capacitor", "Maximum Capacitor Tier") - .addSubChannelUsage("height", "Height of structure") - .addMaintenanceHatch("Any casing") + .addSubChannelUsage("height", "Height of structure").addMaintenanceHatch("Any casing") .toolTipFinisher("KekzTech"); return tt; } @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) { ITexture[] sTexture = new ITexture[] { - TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) - }; + TextureFactory.of(BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; if (aSide == aFacing && aActive) { - sTexture = new ITexture[] { - TextureFactory.of( - BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) - }; + sTexture = new ITexture[] { TextureFactory + .of(BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; } return sTexture; } @@ -567,14 +563,13 @@ public class GTMTE_LapotronicSuperCapacitor } // Check if enough (more than 50%) non-empty caps - if (capacitors[6] - > capacitors[0] - + capacitors[1] - + capacitors[2] - + capacitors[3] - + getUHVCapacitorCount() - + capacitors[6] - + getUEVCapacitorCount()) return false; + if (capacitors[6] > capacitors[0] + capacitors[1] + + capacitors[2] + + capacitors[3] + + getUHVCapacitorCount() + + capacitors[6] + + getUEVCapacitorCount()) + return false; // Calculate total capacity capacity = BigInteger.ZERO; @@ -601,14 +596,40 @@ public class GTMTE_LapotronicSuperCapacitor int layer = Math.min(ChannelDataAccessor.getChannelData(stackSize, "height") + 3, 50); int built; built = survivialBuildPiece( - STRUCTURE_PIECE_BASE, stackSize, 2, 1, 0, elementBudget, source, actor, false, true); + STRUCTURE_PIECE_BASE, + stackSize, + 2, + 1, + 0, + elementBudget, + source, + actor, + false, + true); if (built >= 0) return built; - for (int i = 2; i < layer - 1; i++) - built = survivialBuildPiece( - STRUCTURE_PIECE_MID, stackSize, 2, i, 0, elementBudget, source, actor, false, true); + for (int i = 2; i < layer - 1; i++) built = survivialBuildPiece( + STRUCTURE_PIECE_MID, + stackSize, + 2, + i, + 0, + elementBudget, + source, + actor, + false, + true); if (built >= 0) return built; return survivialBuildPiece( - STRUCTURE_PIECE_TOP, stackSize, 2, layer - 1, 0, elementBudget, source, actor, false, true); + STRUCTURE_PIECE_TOP, + stackSize, + 2, + layer - 1, + 0, + elementBudget, + source, + actor, + false, + true); } @Override @@ -660,8 +681,7 @@ public class GTMTE_LapotronicSuperCapacitor // Output energy to TT hatches for (GT_MetaTileEntity_Hatch_DynamoMulti eDynamo : mDynamoHatchesTT) { - if (eDynamo == null - || eDynamo.getBaseMetaTileEntity() == null + if (eDynamo == null || eDynamo.getBaseMetaTileEntity() == null || eDynamo.getBaseMetaTileEntity().isInvalidTileEntity()) { continue; } @@ -713,8 +733,8 @@ public class GTMTE_LapotronicSuperCapacitor counter = 1; // Find difference. - BigInteger transferred_eu = - stored.subtract((LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))) + BigInteger transferred_eu = stored.subtract( + (LSC_wireless_eu_cap.multiply(BigInteger.valueOf(getUHVCapacitorCount()))) .add(UEV_wireless_eu_cap.multiply(BigInteger.valueOf(getUEVCapacitorCount())))); if (transferred_eu.signum() == 1) { @@ -766,16 +786,15 @@ public class GTMTE_LapotronicSuperCapacitor /** * To be called whenever the maintenance status changes or the capacity was recalculated - * @param repairStatus - * This machine's repair status + * + * @param repairStatus This machine's repair status * @return new BigInteger instance for passiveDischargeAmount */ private long recalculateLossWithMaintenance(int repairStatus) { repairStatusCache = repairStatus; // This cannot overflow because there is a 135 capacitor maximum per LSC. - long temp_capacity_divided = - capacity.divide(BigInteger.valueOf(100L * 86400L * 20L)).longValue(); + long temp_capacity_divided = capacity.divide(BigInteger.valueOf(100L * 86400L * 20L)).longValue(); // Passive loss is multiplied by number of UHV/UEV caps. Minimum of 1 otherwise loss is 0 for non-UHV/UEV caps // calculations. @@ -794,8 +813,8 @@ public class GTMTE_LapotronicSuperCapacitor /** * Calculate how much EU to draw from an Energy Hatch - * @param hatchWatts - * Hatch amperage * voltage + * + * @param hatchWatts Hatch amperage * voltage * @return EU amount */ private long getPowerToDraw(long hatchWatts) { @@ -806,8 +825,8 @@ public class GTMTE_LapotronicSuperCapacitor /** * Calculate how much EU to push into a Dynamo Hatch - * @param hatchWatts - * Hatch amperage * voltage + * + * @param hatchWatts Hatch amperage * voltage * @return EU amount */ private long getPowerToPush(long hatchWatts) { @@ -845,20 +864,26 @@ public class GTMTE_LapotronicSuperCapacitor ll.add("EU OUT: " + GT_Utility.formatNumbers(outputLastTick) + "EU/t"); ll.add("Avg EU IN: " + nf.format(getAvgIn()) + " (last " + secInterval + " seconds)"); ll.add("Avg EU OUT: " + nf.format(getAvgOut()) + " (last " + secInterval + " seconds)"); - ll.add("Maintenance Status: " - + ((super.getRepairStatus() == super.getIdealStatus()) + ll.add( + "Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus()) ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); - ll.add("Wireless mode: " - + (wireless_mode - ? EnumChatFormatting.GREEN + "enabled" + EnumChatFormatting.RESET + ll.add( + "Wireless mode: " + (wireless_mode ? EnumChatFormatting.GREEN + "enabled" + EnumChatFormatting.RESET : EnumChatFormatting.RED + "disabled" + EnumChatFormatting.RESET)); - ll.add(GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + EnumChatFormatting.RESET + " Capacitors detected: " - + getUHVCapacitorCount()); - ll.add(GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + EnumChatFormatting.RESET + " Capacitors detected: " - + getUEVCapacitorCount()); - ll.add("Total wireless EU: " + EnumChatFormatting.RED - + GT_Utility.formatNumbers(getUserEU(global_energy_user_uuid))); + ll.add( + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] + + EnumChatFormatting.RESET + + " Capacitors detected: " + + getUHVCapacitorCount()); + ll.add( + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] + + EnumChatFormatting.RESET + + " Capacitors detected: " + + getUEVCapacitorCount()); + ll.add( + "Total wireless EU: " + EnumChatFormatting.RED + + GT_Utility.formatNumbers(getUserEU(global_energy_user_uuid))); ll.add("---------------------------------------------"); final String[] a = new String[ll.size()]; @@ -924,9 +949,9 @@ public class GTMTE_LapotronicSuperCapacitor return stored.longValue(); } - /* all of these are needed for the injectEnergyUnits() and drainEnergyUnits() - in IGregTechTileEntity - */ + /* + * all of these are needed for the injectEnergyUnits() and drainEnergyUnits() in IGregTechTileEntity + */ @Override public long maxEUInput() { return mMaxEUIn; @@ -965,27 +990,34 @@ public class GTMTE_LapotronicSuperCapacitor } else { GT_Utility.sendChatToPlayer( aPlayer, - "Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + GT_Values.VN[9] - + EnumChatFormatting.RESET + " or " + GT_Values.TIER_COLORS[10] + GT_Values.VN[10] - + EnumChatFormatting.RESET + " capacitor."); + "Wireless mode cannot be enabled without at least 1 " + GT_Values.TIER_COLORS[9] + + GT_Values.VN[9] + + EnumChatFormatting.RESET + + " or " + + GT_Values.TIER_COLORS[10] + + GT_Values.VN[10] + + EnumChatFormatting.RESET + + " capacitor."); wireless_mode = false; } } private enum LSCHatchElement implements IHatchElement<GTMTE_LapotronicSuperCapacitor> { + Energy(GT_MetaTileEntity_Hatch_EnergyMulti.class, GT_MetaTileEntity_Hatch_Energy.class) { + @Override public long count(GTMTE_LapotronicSuperCapacitor t) { return t.mEnergyHatches.size() + t.mEnergyHatchesTT.size() + t.mEnergyTunnelsTT.size(); } }, Dynamo(GT_MetaTileEntity_Hatch_DynamoMulti.class, GT_MetaTileEntity_Hatch_Dynamo.class) { + @Override public long count(GTMTE_LapotronicSuperCapacitor t) { return t.mDynamoHatches.size() + t.mDynamoHatchesTT.size() + t.mDynamoTunnelsTT.size(); } - }, - ; + },; private final List<? extends Class<? extends IMetaTileEntity>> mteClasses; diff --git a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java index ee9c0550b0..428913a029 100644 --- a/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java +++ b/src/main/java/common/tileentities/GTMTE_ModularNuclearReactor.java @@ -1,6 +1,13 @@ package common.tileentities; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraftforge.common.util.ForgeDirection; + +import org.joml.Vector3i; + import common.Blocks; + import gregtech.api.GregTech_API; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; @@ -8,10 +15,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; import gregtech.api.objects.GT_RenderedTexture; -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.common.util.ForgeDirection; -import org.joml.Vector3i; public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBase { @@ -40,56 +43,38 @@ public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBas @Override public String[] getDescription() { - return new String[] {"Disabled"}; + return new String[] { "Disabled" }; /* - final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); - b.addInfo("Can be built, BUT DOES NOT WORK") - .addInfo("Converts fissile material and outputs power or heat") - .addSeparator() - .addInfo("EU-MODE:") - .addInfo(" Directly outputs electricity depending on inserted fuel rods") - .addSeparator() - .addInfo("COOLANT-MODE:") - .addInfo(" Requires coolant to be pumped into the reactor.") - .addInfo(" Coolant is heated and should be drained and converted to electricity by other means.") - .addSeparator() - .addInfo("NOTES:") - .addInfo(" Does NOT use Industrialcraft 2 reactor components!") - .addInfo(" Consult controller GUI on how to arrange the outer casings.") - .addSeparator() - .beginStructureBlock(7, 6, 7) - .addController("Front bottom Center") - .addCasingInfo("Radiation Proof Machine Casing", 100) - .addOtherStructurePart("Control Rods", "Four pillars, four blocks high each. Diagonal to the inner edges of the shell") - .addOtherStructurePart("Nuclear Reactor Chamber", "17 of them to fill out the rest of the floor inside the shell") - .addDynamoHatch("ONLY in EU-mode, at least one") - .addOtherStructurePart("Input Bus, Output Bus", "Optional but required for automation") - .addOtherStructurePart("Input Hatch, Output Hatch", "ONLY in Coolant-Mode, at least one each") - .signAndFinalize("Kekzdealer"); - if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return b.getInformation(); - } else { - return b.getStructureInformation(); - }*/ + * final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); + * b.addInfo("Can be built, BUT DOES NOT WORK") .addInfo("Converts fissile material and outputs power or heat") + * .addSeparator() .addInfo("EU-MODE:") + * .addInfo(" Directly outputs electricity depending on inserted fuel rods") .addSeparator() + * .addInfo("COOLANT-MODE:") .addInfo(" Requires coolant to be pumped into the reactor.") + * .addInfo(" Coolant is heated and should be drained and converted to electricity by other means.") + * .addSeparator() .addInfo("NOTES:") .addInfo(" Does NOT use Industrialcraft 2 reactor components!") + * .addInfo(" Consult controller GUI on how to arrange the outer casings.") .addSeparator() + * .beginStructureBlock(7, 6, 7) .addController("Front bottom Center") + * .addCasingInfo("Radiation Proof Machine Casing", 100) .addOtherStructurePart("Control Rods", + * "Four pillars, four blocks high each. Diagonal to the inner edges of the shell") + * .addOtherStructurePart("Nuclear Reactor Chamber", + * "17 of them to fill out the rest of the floor inside the shell") + * .addDynamoHatch("ONLY in EU-mode, at least one") .addOtherStructurePart("Input Bus, Output Bus", + * "Optional but required for automation") .addOtherStructurePart("Input Hatch, Output Hatch", + * "ONLY in Coolant-Mode, at least one each") .signAndFinalize("Kekzdealer"); + * if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return b.getInformation(); } else { return + * b.getStructureInformation(); } + */ } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { return aSide == aFacing - ? new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - new GT_RenderedTexture( - aActive - ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE - : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER) - } - : new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + ? new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + new GT_RenderedTexture( + aActive ? Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE + : Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER) } + : new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID) }; } @Override @@ -123,51 +108,50 @@ public class GTMTE_ModularNuclearReactor extends GT_MetaTileEntity_MultiBlockBas // Determine the ground level center of the structure final Vector3i center = new Vector3i( - thisController.getXCoord(), thisController.getYCoord(), thisController.getZCoord()) - .add(dirX * 3, 0, dirZ * 3); + thisController.getXCoord(), + thisController.getYCoord(), + thisController.getZCoord()).add(dirX * 3, 0, dirZ * 3); // Scan for outer tube - // - Scan sides + // - Scan sides for (int x = -3; x <= 3; x++) { for (int z = -3; z <= 3; z++) { // Only scan the three wide even sides, skip rest if ((Math.abs(x) <= 1 && Math.abs(z) == 3) || (Math.abs(z) <= 1 && Math.abs(x) == 3)) { for (int h = 0; h < 6; h++) { final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z); - if (h == 0 - && pos.x() == thisController.getXCoord() + if (h == 0 && pos.x() == thisController.getXCoord() && pos.y() == thisController.getYCoord() && pos.z() == thisController.getZCoord()) { // Ignore controller continue; } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) { - minCasingAmount--; - } else { - checklist = false; - } + minCasingAmount--; + } else { + checklist = false; + } } } } } - // - Scan corners of tube + // - Scan corners of tube for (int x = -2; x <= 2; x++) { for (int z = -2; z <= 2; z++) { // Only scan the four corners, skip rest if (Math.abs(x) + Math.abs(z) == 4) { for (int h = 0; h < 6; h++) { final Vector3i pos = new Vector3i(center.x() + x, center.y() + h, center.z() + z); - if (h == 0 - && pos.x() == thisController.getXCoord() + if (h == 0 && pos.x() == thisController.getXCoord() && pos.y() == thisController.getYCoord() && pos.z() == thisController.getZCoord()) { // Ignore controller continue; } else if (thisController.getBlock(pos.x(), pos.y(), pos.z()) == CASING && thisController.getMetaID(pos.x(), pos.y(), pos.z()) == CASING_META) { - minCasingAmount--; - } else { - checklist = false; - } + minCasingAmount--; + } else { + checklist = false; + } } } } diff --git a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java index 11e941584f..a915f07287 100644 --- a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java +++ b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK1.java @@ -4,8 +4,16 @@ import static com.gtnewhorizon.structurelib.structure.StructureUtility.*; import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import common.Blocks; + import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -20,11 +28,6 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidStack; public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_SOFuelCellMK1> { @@ -49,25 +52,23 @@ public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBas private static final int CASING_TEXTURE_ID = 49; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GTMTE_SOFuelCellMK1> STRUCTURE_DEFINITION = - IStructureDefinition.<GTMTE_SOFuelCellMK1>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { - {"ccc", "ccc", "ccc", "ccc", "ccc"}, - {"c~c", "geg", "geg", "geg", "cdc"}, - {"ccc", "ccc", "ccc", "ccc", "ccc"} - })) - .addElement( - 'c', - ofChain( - onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), - ofHatchAdder(GTMTE_SOFuelCellMK1::addInputToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder( - GTMTE_SOFuelCellMK1::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder(GTMTE_SOFuelCellMK1::addOutputToMachineList, CASING_TEXTURE_ID, 1))) - .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK1::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) - .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) - .addElement('e', ofBlockAnyMeta(Blocks.yszUnit)) - .build(); + private static final IStructureDefinition<GTMTE_SOFuelCellMK1> STRUCTURE_DEFINITION = IStructureDefinition + .<GTMTE_SOFuelCellMK1>builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "ccc", "ccc", "ccc", "ccc", "ccc" }, + { "c~c", "geg", "geg", "geg", "cdc" }, { "ccc", "ccc", "ccc", "ccc", "ccc" } })) + .addElement( + 'c', + ofChain( + onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 1)), + ofHatchAdder(GTMTE_SOFuelCellMK1::addInputToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder(GTMTE_SOFuelCellMK1::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder(GTMTE_SOFuelCellMK1::addOutputToMachineList, CASING_TEXTURE_ID, 1))) + .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK1::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) + .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) + .addElement('e', ofBlockAnyMeta(Blocks.yszUnit)).build(); @Override public IStructureDefinition<GTMTE_SOFuelCellMK1> getStructureDefinition() { @@ -79,62 +80,34 @@ public class GTMTE_SOFuelCellMK1 extends GT_MetaTileEntity_EnhancedMultiBlockBas final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Gas Turbine") .addInfo("Oxidizes gas fuels to generate electricity without polluting the environment") - .addInfo("Consumes up to" + (EU_PER_TICK * 20) - + "EU worth of fuel with up to 100% efficiency each second") + .addInfo( + "Consumes up to" + (EU_PER_TICK * 20) + + "EU worth of fuel with up to 100% efficiency each second") .addInfo("Steam production requires the SOFC to heat up completely first") .addInfo("Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_SEC + "L/s Steam") - .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas") - .addSeparator() - .beginStructureBlock(3, 3, 5, false) - .addController("Front center") + .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas").addSeparator() + .beginStructureBlock(3, 3, 5, false).addController("Front center") .addCasingInfo("Clean Stainless Steel Casing", 12) .addOtherStructurePart("YSZ Ceramic Electrolyte Unit", "3x, Center 1x1x3") .addOtherStructurePart("Reinforced Glass", "6x, touching the electrolyte units on the horizontal sides") - .addDynamoHatch("Back center", 1) - .addMaintenanceHatch("Any casing") - .addInputHatch("Fuel, any casing") - .addInputHatch("Oxygen, any casing") - .addOutputHatch("Steam, any casing") - .toolTipFinisher("KekzTech"); + .addDynamoHatch("Back center", 1).addMaintenanceHatch("Any casing").addInputHatch("Fuel, any casing") + .addInputHatch("Oxygen, any casing").addOutputHatch("Steam, any casing").toolTipFinisher("KekzTech"); return tt; } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - if (aActive) - return new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW) - .extFacing() - .glow() - .build() - }; - return new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW) - .extFacing() - .glow() - .build() - }; + if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build() }; } - return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID) }; } @Override diff --git a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java index a7b806add9..8c1aee14ef 100644 --- a/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java +++ b/src/main/java/common/tileentities/GTMTE_SOFuelCellMK2.java @@ -6,8 +6,17 @@ import static gregtech.api.enums.Textures.BlockIcons.*; import static gregtech.api.enums.Textures.BlockIcons.OVERLAY_FRONT_HEAT_EXCHANGER_GLOW; import static gregtech.api.util.GT_StructureUtility.ofHatchAdder; +import java.util.ArrayList; +import java.util.Collection; +import java.util.Iterator; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; + import com.gtnewhorizon.structurelib.structure.IStructureDefinition; import common.Blocks; + import cpw.mods.fml.common.registry.GameRegistry; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; @@ -21,12 +30,6 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_SOFuelCellMK2> { @@ -51,25 +54,23 @@ public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBas private static final int CASING_TEXTURE_ID = 48; private static final String STRUCTURE_PIECE_MAIN = "main"; - private static final IStructureDefinition<GTMTE_SOFuelCellMK2> STRUCTURE_DEFINITION = - IStructureDefinition.<GTMTE_SOFuelCellMK2>builder() - .addShape(STRUCTURE_PIECE_MAIN, transpose(new String[][] { - {"ccc", "ccc", "ccc", "ccc", "ccc"}, - {"c~c", "geg", "geg", "geg", "cdc"}, - {"ccc", "ccc", "ccc", "ccc", "ccc"} - })) - .addElement( - 'c', - ofChain( - onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 0)), - ofHatchAdder(GTMTE_SOFuelCellMK2::addInputToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder( - GTMTE_SOFuelCellMK2::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), - ofHatchAdder(GTMTE_SOFuelCellMK2::addOutputToMachineList, CASING_TEXTURE_ID, 1))) - .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK2::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) - .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) - .addElement('e', ofBlockAnyMeta(Blocks.gdcUnit)) - .build(); + private static final IStructureDefinition<GTMTE_SOFuelCellMK2> STRUCTURE_DEFINITION = IStructureDefinition + .<GTMTE_SOFuelCellMK2>builder() + .addShape( + STRUCTURE_PIECE_MAIN, + transpose( + new String[][] { { "ccc", "ccc", "ccc", "ccc", "ccc" }, + { "c~c", "geg", "geg", "geg", "cdc" }, { "ccc", "ccc", "ccc", "ccc", "ccc" } })) + .addElement( + 'c', + ofChain( + onElementPass(te -> te.mCasing++, ofBlock(GregTech_API.sBlockCasings4, 0)), + ofHatchAdder(GTMTE_SOFuelCellMK2::addInputToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder(GTMTE_SOFuelCellMK2::addMaintenanceToMachineList, CASING_TEXTURE_ID, 1), + ofHatchAdder(GTMTE_SOFuelCellMK2::addOutputToMachineList, CASING_TEXTURE_ID, 1))) + .addElement('d', ofHatchAdder(GTMTE_SOFuelCellMK2::addDynamoToMachineList, CASING_TEXTURE_ID, 1)) + .addElement('g', ofBlockAnyMeta(GameRegistry.findBlock("IC2", "blockAlloyGlass"))) + .addElement('e', ofBlockAnyMeta(Blocks.gdcUnit)).build(); @Override public IStructureDefinition<GTMTE_SOFuelCellMK2> getStructureDefinition() { @@ -81,63 +82,36 @@ public class GTMTE_SOFuelCellMK2 extends GT_MetaTileEntity_EnhancedMultiBlockBas final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); tt.addMachineType("Gas Turbine") .addInfo("Oxidizes gas fuels to generate electricity without polluting the environment") - .addInfo("Consumes up to" + (EU_PER_TICK * 20) - + "EU worth of fuel with up to 100% efficiency each second") + .addInfo( + "Consumes up to" + (EU_PER_TICK * 20) + + "EU worth of fuel with up to 100% efficiency each second") .addInfo("Nitrobenzene and other gas fuels above 1M EU/bucket are more efficient") .addInfo("Steam production requires the SOFC to heat up completely first") .addInfo("Outputs " + EU_PER_TICK + "EU/t and " + STEAM_PER_SEC + "L/s Steam") - .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas") - .addSeparator() - .beginStructureBlock(3, 3, 5, false) - .addController("Front center") + .addInfo("Additionally, requires " + OXYGEN_PER_SEC + "L/s Oxygen gas").addSeparator() + .beginStructureBlock(3, 3, 5, false).addController("Front center") .addCasingInfo("Robust Tungstensteel Machine Casing", 12) .addOtherStructurePart("GDC Ceramic Electrolyte Unit", "3x, Center 1x1x3") .addOtherStructurePart("Reinforced Glass", "6x, touching the electrolyte units on the horizontal sides") - .addDynamoHatch("Back center", 1) - .addMaintenanceHatch("Any casing") - .addInputHatch("Fuel, any casing") - .addInputHatch("Oxygen, any casing") - .addOutputHatch("Superheated Steam, any casing") + .addDynamoHatch("Back center", 1).addMaintenanceHatch("Any casing").addInputHatch("Fuel, any casing") + .addInputHatch("Oxygen, any casing").addOutputHatch("Superheated Steam, any casing") .toolTipFinisher("KekzTech"); return tt; } @Override - public ITexture[] getTexture( - final IGregTechTileEntity aBaseMetaTileEntity, - final byte aSide, - final byte aFacing, - final byte aColorIndex, - final boolean aActive, - final boolean aRedstone) { + public ITexture[] getTexture(final IGregTechTileEntity aBaseMetaTileEntity, final byte aSide, final byte aFacing, + final byte aColorIndex, final boolean aActive, final boolean aRedstone) { if (aSide == aFacing) { - if (aActive) - return new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW) - .extFacing() - .glow() - .build() - }; - return new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW) - .extFacing() - .glow() - .build() - }; + if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_ACTIVE_GLOW).extFacing().glow() + .build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER).extFacing().build(), + TextureFactory.builder().addIcon(OVERLAY_FRONT_HEAT_EXCHANGER_GLOW).extFacing().glow().build() }; } - return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID)}; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID) }; } @Override diff --git a/src/main/java/common/tileentities/GTMTE_SpaceElevator.java b/src/main/java/common/tileentities/GTMTE_SpaceElevator.java index 097c16af59..1a5eb0fd99 100644 --- a/src/main/java/common/tileentities/GTMTE_SpaceElevator.java +++ b/src/main/java/common/tileentities/GTMTE_SpaceElevator.java @@ -1,23 +1,27 @@ package common.tileentities; -import common.Blocks; -import gregtech.api.enums.Dyes; -import gregtech.api.enums.Textures; -import gregtech.api.interfaces.ITexture; -import gregtech.api.interfaces.metatileentity.IMetaTileEntity; -import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; -import gregtech.api.objects.GT_RenderedTexture; import java.util.ArrayList; import java.util.HashSet; + import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.common.util.ForgeDirection; + import util.Vector3i; import util.Vector3ic; +import common.Blocks; + +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Textures; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_MultiBlockBase; +import gregtech.api.objects.GT_RenderedTexture; + public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { private static final Block BASE_BLOCK = Blocks.spaceElevatorStructure; @@ -31,10 +35,10 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { // Scan positions for capacitor banks // Start with top left bank, clockwise // Start with top middle pillar within bank, clockwise, middle last - private static final int[] bankOffsetsX = {-7, 5, 5, -7}; - private static final int[] bankOffsetsY = {-7, -7, 5, 5}; - private static final int[] scanOffsetsX = {1, 2, 1, 0, 1}; - private static final int[] scanOffsetsY = {0, 1, 2, 1, 1}; + private static final int[] bankOffsetsX = { -7, 5, 5, -7 }; + private static final int[] bankOffsetsY = { -7, -7, 5, 5 }; + private static final int[] scanOffsetsX = { 1, 2, 1, 0, 1 }; + private static final int[] scanOffsetsY = { 0, 1, 2, 1, 1 }; private final HashSet<TE_SpaceElevatorCapacitor> capacitors = new HashSet<>(); private long lastLaunchEUCost = 0; @@ -54,49 +58,35 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { @Override public String[] getDescription() { - return new String[] {"Disabled"}; + return new String[] { "Disabled" }; /* - final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); - b.addInfo("Access for your Space Station!") - .addInfo("Check out the wiki on my github if you are having trouble with the structure") - .addInfo("Regenerative Breaking will recover up to X% of the energy spent on launch") - .addInfo("Energy recovered depends on coil tier: +10% per coil tier, up to 90%") - .addSeparator() - .beginStructureBlock(15, 11, 15) - .addController("Bottom Center") - .addEnergyHatch("Instead of any casing in the bottom floor") - .addMaintenanceHatch("Instead of any casing in the bottom floor") - .addCasingInfo("Solid Steel Machine Casing", 320) - .addOtherStructurePart("Any EBF coil", "40x, have to be all the same") - .addOtherStructurePart("Space Elevator Tether", "4x") - .addOtherStructurePart("Space Elevator Cabin Block", "42x") - .addOtherStructurePart("Space Elevator Cabin Guide", "8x") - .signAndFinalize("Kekzdealer"); - if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { - return b.getInformation(); - } else { - return b.getStructureInformation(); - }*/ + * final MultiBlockTooltipBuilder b = new MultiBlockTooltipBuilder(); + * b.addInfo("Access for your Space Station!") + * .addInfo("Check out the wiki on my github if you are having trouble with the structure") + * .addInfo("Regenerative Breaking will recover up to X% of the energy spent on launch") + * .addInfo("Energy recovered depends on coil tier: +10% per coil tier, up to 90%") .addSeparator() + * .beginStructureBlock(15, 11, 15) .addController("Bottom Center") + * .addEnergyHatch("Instead of any casing in the bottom floor") + * .addMaintenanceHatch("Instead of any casing in the bottom floor") + * .addCasingInfo("Solid Steel Machine Casing", 320) .addOtherStructurePart("Any EBF coil", + * "40x, have to be all the same") .addOtherStructurePart("Space Elevator Tether", "4x") + * .addOtherStructurePart("Space Elevator Cabin Block", "42x") + * .addOtherStructurePart("Space Elevator Cabin Guide", "8x") .signAndFinalize("Kekzdealer"); + * if(!Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)) { return b.getInformation(); } else { return + * b.getStructureInformation(); } + */ } @Override - public ITexture[] getTexture( - IGregTechTileEntity aBaseMetaTileEntity, - byte aSide, - byte aFacing, - byte aColorIndex, - boolean aActive, - boolean aRedstone) { - ITexture[] sTexture = new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, Dyes.getModulation(-1, Dyes._NULL.mRGBa)) - }; + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { + ITexture[] sTexture = new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS, + Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; if (aSide == aFacing && aActive) { - sTexture = new ITexture[] { - new GT_RenderedTexture( - Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, - Dyes.getModulation(-1, Dyes._NULL.mRGBa)) - }; + sTexture = new ITexture[] { new GT_RenderedTexture( + Textures.BlockIcons.MACHINE_CASING_FUSION_GLASS_YELLOW, + Dyes.getModulation(-1, Dyes._NULL.mRGBa)) }; } return sTexture; } @@ -152,8 +142,8 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { } final Vector3ic offset = rotateOffsetVector(forgeDirection, X, Y, 0); - final IGregTechTileEntity currentTE = - thisController.getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); + final IGregTechTileEntity currentTE = thisController + .getIGregTechTileEntityOffset(offset.x(), offset.y(), offset.z()); // Tries to add TE as either of those kinds of hatches. // The number is the texture index number for the texture that needs to be painted over the hatch @@ -193,8 +183,8 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { } else { if (scan == 4) { // Check for capacitors - final TileEntity te = - thisController.getTileEntityOffset(offset.x(), offset.y(), offset.z()); + final TileEntity te = thisController + .getTileEntityOffset(offset.x(), offset.y(), offset.z()); if (thisController.getBlockOffset(offset.x(), offset.y(), offset.z()) == CAP_BLOCK && te instanceof TE_SpaceElevatorCapacitor) { capacitors.add((TE_SpaceElevatorCapacitor) te); @@ -203,9 +193,7 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { } } else { // Check for Glass - if (!thisController - .getBlockOffset(offset.x(), offset.y(), offset.z()) - .getUnlocalizedName() + if (!thisController.getBlockOffset(offset.x(), offset.y(), offset.z()).getUnlocalizedName() .equals(glassNameBorosilicate)) { formationChecklist = false; } @@ -236,8 +224,8 @@ public class GTMTE_SpaceElevator extends GT_MetaTileEntity_MultiBlockBase { final ArrayList<String> ll = new ArrayList<>(); ll.add(EnumChatFormatting.YELLOW + "Operational Data:" + EnumChatFormatting.RESET); - ll.add("Maintenance Status: " - + ((super.getRepairStatus() == super.getIdealStatus()) + ll.add( + "Maintenance Status: " + ((super.getRepairStatus() == super.getIdealStatus()) ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); ll.add("---------------------------------------------"); diff --git a/src/main/java/common/tileentities/GTMTE_TFFT.java b/src/main/java/common/tileentities/GTMTE_TFFT.java index e3f7951cdb..8978ae90a9 100644 --- a/src/main/java/common/tileentities/GTMTE_TFFT.java +++ b/src/main/java/common/tileentities/GTMTE_TFFT.java @@ -5,6 +5,24 @@ import static gregtech.api.enums.GT_HatchElement.*; import static gregtech.api.util.GT_StructureUtility.buildHatchAdder; import static java.lang.Math.min; +import java.math.BigInteger; +import java.text.MessageFormat; +import java.text.NumberFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.fluids.FluidRegistry; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + import com.github.bartimaeusnek.bartworks.API.BorosilicateGlass; import com.gtnewhorizon.structurelib.StructureLibAPI; import com.gtnewhorizon.structurelib.alignment.constructable.ChannelDataAccessor; @@ -12,6 +30,7 @@ import com.gtnewhorizon.structurelib.alignment.constructable.ISurvivalConstructa import com.gtnewhorizon.structurelib.structure.*; import com.gtnewhorizon.structurelib.util.ItemStackPredicate; import common.Blocks; + import gregtech.api.enums.Textures; import gregtech.api.fluid.FluidTankGT; import gregtech.api.interfaces.IHatchElement; @@ -26,26 +45,11 @@ import gregtech.api.util.GT_Multiblock_Tooltip_Builder; import gregtech.api.util.GT_Utility; import gregtech.api.util.IGT_HatchAdder; import gregtech.common.items.GT_IntegratedCircuit_Item; -import java.math.BigInteger; -import java.text.MessageFormat; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidRegistry; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_TFFT> implements ISurvivalConstructable { public enum Field { + T1(1_000_000L, 1), // LV T2(4_000_000L, 2), // MV T3(16_000_000L, 5), // HV @@ -78,6 +82,7 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T } private enum TFFTMultiHatch implements IHatchElement<GTMTE_TFFT> { + INSTANCE; private final List<? extends Class<? extends IMetaTileEntity>> mteClasses; @@ -104,6 +109,7 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T } private enum TFFTStorageFieldElement implements IStructureElement<GTMTE_TFFT> { + INSTANCE; @Override @@ -132,18 +138,16 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T } @Override - public PlaceResult survivalPlaceBlock( - GTMTE_TFFT t, World world, int x, int y, int z, ItemStack trigger, AutoPlaceEnvironment env) { + public PlaceResult survivalPlaceBlock(GTMTE_TFFT t, World world, int x, int y, int z, ItemStack trigger, + AutoPlaceEnvironment env) { if (check(t, world, x, y, z)) return PlaceResult.SKIP; int fieldTier = getHint(trigger); - ItemStack result = env.getSource() - .takeOne( - s -> s != null - && s.stackSize >= 0 - && s.getItem() == TFFT_FIELD_ITEM - && s.getItemDamage() != CASING_META - && s.getItemDamage() <= fieldTier, - true); + ItemStack result = env.getSource().takeOne( + s -> s != null && s.stackSize >= 0 + && s.getItem() == TFFT_FIELD_ITEM + && s.getItemDamage() != CASING_META + && s.getItemDamage() <= fieldTier, + true); if (result == null) return PlaceResult.REJECT; return StructureUtility.survivalPlaceBlock( @@ -162,18 +166,17 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T } private static final IIconContainer TEXTURE_TFFT = new Textures.BlockIcons.CustomIcon("iconsets/TFFT"); - private static final IIconContainer TEXTURE_TFFT_ACTIVE = - new Textures.BlockIcons.CustomIcon("iconsets/TFFT_ACTIVE"); - private static final IIconContainer TEXTURE_TFFT_ACTIVE_GLOW = - new Textures.BlockIcons.CustomIcon("iconsets/TFFT_ACTIVE_GLOW"); + private static final IIconContainer TEXTURE_TFFT_ACTIVE = new Textures.BlockIcons.CustomIcon( + "iconsets/TFFT_ACTIVE"); + private static final IIconContainer TEXTURE_TFFT_ACTIVE_GLOW = new Textures.BlockIcons.CustomIcon( + "iconsets/TFFT_ACTIVE_GLOW"); private static final int CASING_TEXTURE_ID_1 = (12 << 7) | 127; private static final int CASING_TEXTURE_ID_2 = 176; private static final Block TFFT_FIELD = Blocks.tfftStorageField; private static final Item TFFT_FIELD_ITEM = Item.getItemFromBlock(TFFT_FIELD); public static final int MAX_DISTINCT_FLUIDS = 25; - private static final BigInteger MAX_CAPACITY = - BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(25)); + private static final BigInteger MAX_CAPACITY = BigInteger.valueOf(Long.MAX_VALUE).multiply(BigInteger.valueOf(25)); private static final int CASING_META = 0; private static final int MIN_CASING_AMOUNT = 20; private static final int MAX_LAYER_AMOUNT = 13; @@ -185,57 +188,47 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T // height channel for height // field channel for field - private static final IStructureDefinition<GTMTE_TFFT> STRUCTURE_DEFINITION = - IStructureDefinition.<GTMTE_TFFT>builder() - .addShape( - STRUCTURE_PIECE_TOP, - transpose(new String[][] {{"ccccc"}, {"cCCCc"}, {"cC~Cc"}, {"cCCCc"}, {"ccccc"}})) - .addShape( - STRUCTURE_PIECE_MID, - transpose(new String[][] {{"gGGGg"}, {"GfffG"}, {"GfffG"}, {"GfffG"}, {"gGGGg"}})) - .addShape( - STRUCTURE_PIECE_BOTTOM, - transpose(new String[][] {{"ccccc"}, {"cCCCc"}, {"cCCCc"}, {"cCCCc"}, {"ccccc"}})) - .addElement( - 'c', - buildHatchAdder(GTMTE_TFFT.class) - .atLeast(Energy, Maintenance) - .casingIndex(CASING_TEXTURE_ID_1) - .dot(1) - .buildAndChain( - onElementPass(te -> te.casingAmount++, ofBlock(TFFT_FIELD, CASING_META)))) - .addElement( - 'C', - buildHatchAdder(GTMTE_TFFT.class) - .casingIndex(CASING_TEXTURE_ID_1) - .atLeast( - Energy, - Maintenance, - InputHatch.or(TFFTMultiHatch.INSTANCE), - OutputHatch.or(TFFTMultiHatch.INSTANCE)) - .dot(2) - .buildAndChain( - onElementPass(te -> te.casingAmount++, ofBlock(TFFT_FIELD, CASING_META)))) - .addElement( - 'G', - buildHatchAdder(GTMTE_TFFT.class) - .atLeast( - InputHatch.or(TFFTMultiHatch.INSTANCE), - OutputHatch.or(TFFTMultiHatch.INSTANCE)) - .casingIndex(CASING_TEXTURE_ID_2) - .dot(3) - .buildAndChain( - ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), - ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false), - BorosilicateGlass.ofBoroGlassAnyTier())) - .addElement( - 'g', - ofChain( + private static final IStructureDefinition<GTMTE_TFFT> STRUCTURE_DEFINITION = IStructureDefinition + .<GTMTE_TFFT>builder() + .addShape( + STRUCTURE_PIECE_TOP, + transpose(new String[][] { { "ccccc" }, { "cCCCc" }, { "cC~Cc" }, { "cCCCc" }, { "ccccc" } })) + .addShape( + STRUCTURE_PIECE_MID, + transpose(new String[][] { { "gGGGg" }, { "GfffG" }, { "GfffG" }, { "GfffG" }, { "gGGGg" } })) + .addShape( + STRUCTURE_PIECE_BOTTOM, + transpose(new String[][] { { "ccccc" }, { "cCCCc" }, { "cCCCc" }, { "cCCCc" }, { "ccccc" } })) + .addElement( + 'c', + buildHatchAdder(GTMTE_TFFT.class).atLeast(Energy, Maintenance).casingIndex(CASING_TEXTURE_ID_1) + .dot(1) + .buildAndChain(onElementPass(te -> te.casingAmount++, ofBlock(TFFT_FIELD, CASING_META)))) + .addElement( + 'C', + buildHatchAdder(GTMTE_TFFT.class).casingIndex(CASING_TEXTURE_ID_1) + .atLeast( + Energy, + Maintenance, + InputHatch.or(TFFTMultiHatch.INSTANCE), + OutputHatch.or(TFFTMultiHatch.INSTANCE)) + .dot(2) + .buildAndChain(onElementPass(te -> te.casingAmount++, ofBlock(TFFT_FIELD, CASING_META)))) + .addElement( + 'G', + buildHatchAdder(GTMTE_TFFT.class) + .atLeast(InputHatch.or(TFFTMultiHatch.INSTANCE), OutputHatch.or(TFFTMultiHatch.INSTANCE)) + .casingIndex(CASING_TEXTURE_ID_2).dot(3).buildAndChain( ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false), BorosilicateGlass.ofBoroGlassAnyTier())) - .addElement('f', ofChain(TFFTStorageFieldElement.INSTANCE)) - .build(); + .addElement( + 'g', + ofChain( + ofBlockUnlocalizedName("IC2", "blockAlloyGlass", 0, true), + ofBlockUnlocalizedName("Thaumcraft", "blockCosmeticOpaque", 2, false), + BorosilicateGlass.ofBoroGlassAnyTier())) + .addElement('f', ofChain(TFFTStorageFieldElement.INSTANCE)).build(); public final FluidTankGT[] STORE = new FluidTankGT[MAX_DISTINCT_FLUIDS]; @@ -277,65 +270,44 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T } @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[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1), - TextureFactory.builder() - .addIcon(TEXTURE_TFFT_ACTIVE) - .extFacing() - .build(), - TextureFactory.builder() - .addIcon(TEXTURE_TFFT_ACTIVE_GLOW) - .extFacing() - .glow() - .build() - }; - return new ITexture[] { - Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1), - TextureFactory.builder().addIcon(TEXTURE_TFFT).extFacing().build() - }; - } - return new ITexture[] {Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1)}; + if (aActive) return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1), + TextureFactory.builder().addIcon(TEXTURE_TFFT_ACTIVE).extFacing().build(), + TextureFactory.builder().addIcon(TEXTURE_TFFT_ACTIVE_GLOW).extFacing().glow().build() }; + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1), + TextureFactory.builder().addIcon(TEXTURE_TFFT).extFacing().build() }; + } + return new ITexture[] { Textures.BlockIcons.getCasingTextureForId(CASING_TEXTURE_ID_1) }; } @Override protected GT_Multiblock_Tooltip_Builder createTooltip() { final GT_Multiblock_Tooltip_Builder tt = new GT_Multiblock_Tooltip_Builder(); - tt.addMachineType("Fluid Tank") - .addInfo("High-Tech fluid tank that can hold up to 25 different fluids!") + tt.addMachineType("Fluid Tank").addInfo("High-Tech fluid tank that can hold up to 25 different fluids!") .addInfo("Has 1/25th of the total capacity as capacity for each fluid.") .addInfo("Right clicking the controller with a screwdriver will turn on excess voiding.") .addInfo("Fluid storage amount and running cost depends on the storage field blocks used.") - .addSeparator() - .addInfo("Note on hatch locking:") + .addSeparator().addInfo("Note on hatch locking:") .addInfo("Use an Integrated Circuit in the GUI slot to limit which fluid is output.") - .addInfo("The index of a stored fluid can be obtained through the Tricorder.") - .addSeparator() - .beginVariableStructureBlock(5, 5, 5, 15, 5, 5, false) - .addController("Top Center") + .addInfo("The index of a stored fluid can be obtained through the Tricorder.").addSeparator() + .beginVariableStructureBlock(5, 5, 5, 15, 5, 5, false).addController("Top Center") .addCasingInfo("T.F.F.T Casing", MIN_CASING_AMOUNT) .addOtherStructurePart("Storage Field Blocks (Tier I-X)", "Inner 3xhx3 solid pillar") .addStructureInfo("Energy hatch is not required when running cost is 0") .addOtherStructurePart( - "Borosilicate Glass(any)/Warded Glass/Reinforced Glass", "Outer 5xhx5 glass shell") - .addMaintenanceHatch("Any top or bottom casing") - .addEnergyHatch("Any top or bottom casing") + "Borosilicate Glass(any)/Warded Glass/Reinforced Glass", + "Outer 5xhx5 glass shell") + .addMaintenanceHatch("Any top or bottom casing").addEnergyHatch("Any top or bottom casing") .addInputHatch("Instead of any casing or glass, has to touch storage field block") .addOutputHatch("Instead of any casing or glass, has to touch storage field block") .addStructureInfo("You can have a bunch of hatches") .addOtherStructurePart( - "Multi I/O Hatches", "Instead of any casing or glass, has to touch storage field block") + "Multi I/O Hatches", + "Instead of any casing or glass, has to touch storage field block") .addStructureInfo("Use MIOH with conduits or fluid storage busses to see all fluids at once.") - .addSubChannelUsage("field", "Maximum Field Tier") - .addSubChannelUsage("height", "Height of structure") + .addSubChannelUsage("field", "Maximum Field Tier").addSubChannelUsage("height", "Height of structure") .toolTipFinisher("KekzTech"); return tt; } @@ -462,8 +434,7 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T tHatch.fill(this.push(sFluid.get(remaining), true), true); } else if (isFluidLocked) { - if (!isFluidEmpty - && !lockedFluidName.equals(tFluid.getFluid().getName())) continue; + if (!isFluidEmpty && !lockedFluidName.equals(tFluid.getFluid().getName())) continue; FluidStack aFluid = FluidRegistry.getFluidStack(lockedFluidName, remaining); tHatch.fill(this.push(aFluid, true), true); @@ -500,8 +471,8 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T } else { String localizedName = STORE[i].get().getLocalizedName(); String amount = nf.format(STORE[i].amount()); - String percentage = - capacityPerFluid > 0 ? String.valueOf(STORE[i].amount() * 100 / capacityPerFluid) : ""; + String percentage = capacityPerFluid > 0 ? String.valueOf(STORE[i].amount() * 100 / capacityPerFluid) + : ""; ll.add(MessageFormat.format("{0} - {1}: {2}L ({3}%)", i, localizedName, amount, percentage)); } @@ -512,8 +483,8 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T ll.add("Per-Fluid Capacity: " + nf.format(capacityPerFluid) + "L"); ll.add("Running Cost: " + getActualEnergyUsage() + "EU/t"); ll.add("Auto-voiding: " + doVoidExcess); - ll.add("Maintenance Status: " - + ((getRepairStatus() == getIdealStatus()) + ll.add( + "Maintenance Status: " + ((getRepairStatus() == getIdealStatus()) ? EnumChatFormatting.GREEN + "Working perfectly" + EnumChatFormatting.RESET : EnumChatFormatting.RED + "Has Problems" + EnumChatFormatting.RESET)); ll.add("---------------------------------------------"); @@ -617,8 +588,7 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T if (index >= 0) { FluidTankGT tank = STORE[index]; if (doPull) return tank.add(amount); - return doVoidExcess - ? amount + return doVoidExcess ? amount : tank.amount() + amount > tank.capacity() ? tank.capacity() - tank.amount() : amount; } else if (fluidCount() < MAX_DISTINCT_FLUIDS) { FluidTankGT tank = STORE[getNullSlot()]; @@ -660,8 +630,7 @@ public class GTMTE_TFFT extends GT_MetaTileEntity_EnhancedMultiBlockBase<GTMTE_T this.capacityPerFluid = Long.MAX_VALUE; } else { this.capacity = capacity; - this.capacityPerFluid = - capacity.divide(BigInteger.valueOf(MAX_DISTINCT_FLUIDS)).longValue(); + this.capacityPerFluid = capacity.divide(BigInteger.valueOf(MAX_DISTINCT_FLUIDS)).longValue(); } for (int i = 0; i < MAX_DISTINCT_FLUIDS; i++) { diff --git a/src/main/java/common/tileentities/GTMTE_TFFTHatch.java b/src/main/java/common/tileentities/GTMTE_TFFTHatch.java index bf79bb877e..37e3ade77a 100644 --- a/src/main/java/common/tileentities/GTMTE_TFFTHatch.java +++ b/src/main/java/common/tileentities/GTMTE_TFFTHatch.java @@ -1,5 +1,12 @@ package common.tileentities; +import java.util.HashMap; + +import net.minecraft.tileentity.TileEntity; +import net.minecraftforge.common.util.ForgeDirection; +import net.minecraftforge.fluids.FluidStack; +import net.minecraftforge.fluids.FluidTankInfo; + import appeng.api.AEApi; import appeng.api.config.AccessRestriction; import appeng.api.config.Actionable; @@ -18,11 +25,6 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; import gregtech.api.render.TextureFactory; -import java.util.HashMap; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; -import net.minecraftforge.fluids.FluidStack; -import net.minecraftforge.fluids.FluidTankInfo; @Optional.Interface(iface = "appeng.api.storage.IMEMonitor", modid = "appliedenergistics2", striprefs = true) public class GTMTE_TFFTHatch extends GT_MetaTileEntity_Hatch implements IMEMonitor<IAEFluidStack> { @@ -36,15 +38,14 @@ public class GTMTE_TFFTHatch extends GT_MetaTileEntity_Hatch implements IMEMonit @Override @Optional.Method(modid = "appliedenergistics2") public boolean canHandle(TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource mySrc) { - return channel == StorageChannel.FLUIDS - && te instanceof BaseMetaTileEntity + return channel == StorageChannel.FLUIDS && te instanceof BaseMetaTileEntity && ((BaseMetaTileEntity) te).getMetaTileEntity() instanceof GTMTE_TFFTHatch; } @Override @Optional.Method(modid = "appliedenergistics2") - public IMEInventory getInventory( - TileEntity te, ForgeDirection d, StorageChannel channel, BaseActionSource src) { + public IMEInventory getInventory(TileEntity te, ForgeDirection d, StorageChannel channel, + BaseActionSource src) { if (channel == StorageChannel.FLUIDS) { return ((GTMTE_TFFTHatch) (((BaseMetaTileEntity) te).getMetaTileEntity())); } @@ -52,8 +53,8 @@ public class GTMTE_TFFTHatch extends GT_MetaTileEntity_Hatch implements IMEMonit } } - private static final Textures.BlockIcons.CustomIcon TEXTURE_TFFT_HATCH = - new Textures.BlockIcons.CustomIcon("iconsets/TFFT_HATCH"); + private static final Textures.BlockIcons.CustomIcon TEXTURE_TFFT_HATCH = new Textures.BlockIcons.CustomIcon( + "iconsets/TFFT_HATCH"); private HashMap<IMEMonitorHandlerReceiver<IAEFluidStack>, Object> listeners = new HashMap<>(); private GTMTE_TFFT controller; @@ -72,32 +73,21 @@ public class GTMTE_TFFTHatch extends GT_MetaTileEntity_Hatch implements IMEMonit } @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) { return super.getTexture(aBaseMetaTileEntity, aSide, aFacing, aColorIndex, aActive, aRedstone); } @Override public ITexture[] getTexturesActive(ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, - TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_IN), - TextureFactory.builder().addIcon(TEXTURE_TFFT_HATCH).extFacing().build() - }; + return new ITexture[] { aBaseTexture, TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_IN), + TextureFactory.builder().addIcon(TEXTURE_TFFT_HATCH).extFacing().build() }; } @Override public ITexture[] getTexturesInactive(ITexture aBaseTexture) { - return new ITexture[] { - aBaseTexture, - TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_IN), - TextureFactory.builder().addIcon(TEXTURE_TFFT_HATCH).extFacing().build() - }; + return new ITexture[] { aBaseTexture, TextureFactory.of(Textures.BlockIcons.OVERLAY_PIPE_IN), + TextureFactory.builder().addIcon(TEXTURE_TFFT_HATCH).extFacing().build() }; } @Override diff --git a/src/main/java/common/tileentities/TE_BeamTransmitter.java b/src/main/java/common/tileentities/TE_BeamTransmitter.java index 74cb845fc4..1d6915ade2 100644 --- a/src/main/java/common/tileentities/TE_BeamTransmitter.java +++ b/src/main/java/common/tileentities/TE_BeamTransmitter.java @@ -1,12 +1,14 @@ package common.tileentities; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; + import org.joml.Vector3i; import org.joml.Vector3ic; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TE_BeamTransmitter extends TileEntity { private final Vector3ic position; diff --git a/src/main/java/common/tileentities/TE_ItemProxyCable.java b/src/main/java/common/tileentities/TE_ItemProxyCable.java index ac080ceab2..1dc539c89e 100644 --- a/src/main/java/common/tileentities/TE_ItemProxyCable.java +++ b/src/main/java/common/tileentities/TE_ItemProxyCable.java @@ -16,9 +16,10 @@ public class TE_ItemProxyCable extends TileEntity { public void updateEntity() { // Check all 6 sides and connect the conduit if it is allowed to for (ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) { - final TileEntity te = super.getWorldObj() - .getTileEntity( - super.xCoord + side.offsetX, super.yCoord + side.offsetY, super.zCoord + side.offsetZ); + final TileEntity te = super.getWorldObj().getTileEntity( + super.xCoord + side.offsetX, + super.yCoord + side.offsetY, + super.zCoord + side.offsetZ); if (te instanceof TE_ItemProxyCable) { final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; setConnection(side, cable.isConnectionAllowed(side.getOpposite())); @@ -33,8 +34,7 @@ public class TE_ItemProxyCable extends TileEntity { } /** - * Builds a simple unique identifier for this TileEntity by appending - * the x, y, and z coordinates in a string. + * Builds a simple unique identifier for this TileEntity by appending the x, y, and z coordinates in a string. * * @return unique identifier for this TileEntity */ @@ -48,20 +48,17 @@ public class TE_ItemProxyCable extends TileEntity { } /** - * 0 0 0 0 0 0 0 0 = 0 -> no connection </br> - * 0 0 0 0 0 0 0 1 = 1 -> down </br> - * 0 0 0 0 0 0 1 0 = 2 -> up </br> - * 0 0 0 0 0 1 0 0 = 4 -> north </br> - * 0 0 0 0 1 0 0 0 = 8 -> south </br> - * 0 0 0 1 0 0 0 0 = 16 -> west </br> - * 0 0 1 0 0 0 0 0 = 32 -> east </br> + * 0 0 0 0 0 0 0 0 = 0 -> no connection </br> + * 0 0 0 0 0 0 0 1 = 1 -> down </br> + * 0 0 0 0 0 0 1 0 = 2 -> up </br> + * 0 0 0 0 0 1 0 0 = 4 -> north </br> + * 0 0 0 0 1 0 0 0 = 8 -> south </br> + * 0 0 0 1 0 0 0 0 = 16 -> west </br> + * 0 0 1 0 0 0 0 0 = 32 -> east </br> * - * @param side - * The side for which to set the connection status. - * @param connected - * Whether this side should be connected or not - * @return - * True if the connection was allowed + * @param side The side for which to set the connection status. + * @param connected Whether this side should be connected or not + * @return True if the connection was allowed */ public boolean setConnection(ForgeDirection side, boolean connected) { if (isConnectionAllowed(side)) { diff --git a/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java b/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java index 88a8ef8bda..7d58a21c61 100644 --- a/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java +++ b/src/main/java/common/tileentities/TE_ItemProxyEndpoint.java @@ -1,6 +1,7 @@ package common.tileentities; import java.util.HashSet; + import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; @@ -43,9 +44,10 @@ public class TE_ItemProxyEndpoint extends TileEntity implements ISidedInventory final HashSet<String> visited = new HashSet<>(); for (ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { - final TileEntity te = super.getWorldObj() - .getTileEntity( - super.xCoord + next.offsetX, super.yCoord + next.offsetY, super.zCoord + next.offsetZ); + final TileEntity te = super.getWorldObj().getTileEntity( + super.xCoord + next.offsetX, + super.yCoord + next.offsetY, + super.zCoord + next.offsetZ); if (te instanceof TE_ItemProxyCable) { final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; if (cable.isConnected(next.getOpposite())) { @@ -61,22 +63,18 @@ public class TE_ItemProxyEndpoint extends TileEntity implements ISidedInventory } } - private void searchSourceRecursive( - HashSet<TE_ItemProxySource> sources, - HashSet<String> visited, - ForgeDirection from, - TE_ItemProxyCable nextTarget) { + private void searchSourceRecursive(HashSet<TE_ItemProxySource> sources, HashSet<String> visited, + ForgeDirection from, TE_ItemProxyCable nextTarget) { if (!visited.contains(nextTarget.getIdentifier())) { visited.add(nextTarget.getIdentifier()); for (ForgeDirection next : ForgeDirection.VALID_DIRECTIONS) { if (next != from) { - final TileEntity te = super.getWorldObj() - .getTileEntity( - nextTarget.xCoord + next.offsetX, - nextTarget.yCoord + next.offsetY, - nextTarget.zCoord + next.offsetZ); + final TileEntity te = super.getWorldObj().getTileEntity( + nextTarget.xCoord + next.offsetX, + nextTarget.yCoord + next.offsetY, + nextTarget.zCoord + next.offsetZ); if (te instanceof TE_ItemProxyCable) { final TE_ItemProxyCable cable = (TE_ItemProxyCable) te; if (cable.isConnected(next.getOpposite())) { @@ -162,7 +160,7 @@ public class TE_ItemProxyEndpoint extends TileEntity implements ISidedInventory @Override public int[] getAccessibleSlotsFromSide(int side) { - return new int[] {0}; + return new int[] { 0 }; } @Override diff --git a/src/main/java/common/tileentities/TE_ItemProxySource.java b/src/main/java/common/tileentities/TE_ItemProxySource.java index 15a93ed91a..78c338b920 100644 --- a/src/main/java/common/tileentities/TE_ItemProxySource.java +++ b/src/main/java/common/tileentities/TE_ItemProxySource.java @@ -11,8 +11,7 @@ public class TE_ItemProxySource extends TileEntity implements IInventory { private String idCache = null; /** - * Builds a simple unique identifier for this TileEntity by appending - * the x, y, and z coordinates in a string. + * Builds a simple unique identifier for this TileEntity by appending the x, y, and z coordinates in a string. * * @return unique identifier for this TileEntity */ diff --git a/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java b/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java index a8de775f98..ea5211bfba 100644 --- a/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java +++ b/src/main/java/common/tileentities/TE_SpaceElevatorCapacitor.java @@ -9,10 +9,9 @@ public class TE_SpaceElevatorCapacitor extends TileEntity { /** * Called by {@link GTMTE_SpaceElevator} while charging - * @param charge - * Current elevator charge - * @param maxCharge - * Charge level it is trying to reach + * + * @param charge Current elevator charge + * @param maxCharge Charge level it is trying to reach */ public void updateChargeLevel(int charge, int maxCharge) { chargeLevel = ((float) charge) / ((float) maxCharge); @@ -20,8 +19,8 @@ public class TE_SpaceElevatorCapacitor extends TileEntity { /** * Called by {@link client.renderer.TESR_SECapacitor} to calculate the block's colour saturation - * @return - * Charge level from 0.0F to 1.0F + * + * @return Charge level from 0.0F to 1.0F */ public float getChargeLevel() { return chargeLevel; @@ -36,8 +35,8 @@ public class TE_SpaceElevatorCapacitor extends TileEntity { /** * Called by {@link GTMTE_SpaceElevator} in case of maintenance issues - * @param isDamaged - * has maintenance issue + * + * @param isDamaged has maintenance issue */ public void setIsDamaged(boolean isDamaged) { this.isDamaged = isDamaged; @@ -45,8 +44,8 @@ public class TE_SpaceElevatorCapacitor extends TileEntity { /** * Called by {@link client.renderer.TESR_SECapacitor} to check whether the block should be rendered red - * @return - * should be rendered red + * + * @return should be rendered red */ public boolean isDamaged() { return isDamaged; diff --git a/src/main/java/common/tileentities/TE_SpaceElevatorTether.java b/src/main/java/common/tileentities/TE_SpaceElevatorTether.java index c4df059563..7e76a9c14d 100644 --- a/src/main/java/common/tileentities/TE_SpaceElevatorTether.java +++ b/src/main/java/common/tileentities/TE_SpaceElevatorTether.java @@ -1,10 +1,11 @@ package common.tileentities; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; + public class TE_SpaceElevatorTether extends TileEntity { @SideOnly(Side.CLIENT) |