|
| 1 | +package com.hepdd.easytech.common.tileentities.machines.multi; |
| 2 | + |
| 3 | +import static gregtech.api.util.GTWaila.getMachineProgressString; |
| 4 | +import static mods.railcraft.common.blocks.machine.alpha.EnumMachineAlpha.COKE_OVEN; |
| 5 | + |
| 6 | +import java.util.List; |
| 7 | + |
| 8 | +import net.minecraft.block.Block; |
| 9 | +import net.minecraft.entity.player.EntityPlayerMP; |
| 10 | +import net.minecraft.item.ItemStack; |
| 11 | +import net.minecraft.nbt.NBTTagCompound; |
| 12 | +import net.minecraft.tileentity.TileEntity; |
| 13 | +import net.minecraft.world.World; |
| 14 | +import net.minecraftforge.common.util.ForgeDirection; |
| 15 | + |
| 16 | +import gregtech.GTMod; |
| 17 | +import gregtech.api.enums.SteamVariant; |
| 18 | +import gregtech.api.enums.Textures; |
| 19 | +import gregtech.api.interfaces.ISecondaryDescribable; |
| 20 | +import gregtech.api.interfaces.ITexture; |
| 21 | +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; |
| 22 | +import gregtech.api.metatileentity.MetaTileEntity; |
| 23 | +import gregtech.api.render.TextureFactory; |
| 24 | +import gregtech.api.util.MultiblockTooltipBuilder; |
| 25 | +import mcp.mobius.waila.api.IWailaConfigHandler; |
| 26 | +import mcp.mobius.waila.api.IWailaDataAccessor; |
| 27 | + |
| 28 | +public class ETHBigCokeOven extends ETHCokeOven implements ISecondaryDescribable { |
| 29 | + |
| 30 | + private static final ITexture[] FACING_SIDE = { |
| 31 | + TextureFactory.of(new Textures.BlockIcons.CustomIcon("iconsets/MACHINE_CASING_COKEOVEN")) }; |
| 32 | + private static final ITexture[] FACING_FRONT = { |
| 33 | + TextureFactory.of(new Textures.BlockIcons.CustomIcon("iconsets/MACHINE_CASING_COKEOVEN_INACTIVE")) }; |
| 34 | + private static final ITexture[] FACING_ACTIVE = { |
| 35 | + TextureFactory.of(new Textures.BlockIcons.CustomIcon("iconsets/MACHINE_CASING_COKEOVEN_ACTIVE")) }; |
| 36 | + private MultiblockTooltipBuilder tooltipBuilder; |
| 37 | + |
| 38 | + public ETHBigCokeOven(int aID, String aName, String aNameRegional) { |
| 39 | + super(aID, aName, aNameRegional); |
| 40 | + } |
| 41 | + |
| 42 | + public ETHBigCokeOven(String aName) { |
| 43 | + super(aName); |
| 44 | + } |
| 45 | + |
| 46 | + @Override |
| 47 | + public String[] getDescription() { |
| 48 | + return getCurrentDescription(); |
| 49 | + } |
| 50 | + |
| 51 | + // @Override |
| 52 | + // public boolean isDisplaySecondaryDescription() { |
| 53 | + // return ISecondaryDescribable.super.isDisplaySecondaryDescription(); |
| 54 | + // } |
| 55 | + |
| 56 | + public String[] getPrimaryDescription() { |
| 57 | + return getTooltip().getInformation(); |
| 58 | + } |
| 59 | + |
| 60 | + public String[] getSecondaryDescription() { |
| 61 | + return getTooltip().getStructureInformation(); |
| 62 | + } |
| 63 | + |
| 64 | + protected MultiblockTooltipBuilder getTooltip() { |
| 65 | + if (tooltipBuilder == null) { |
| 66 | + tooltipBuilder = new MultiblockTooltipBuilder(); |
| 67 | + tooltipBuilder.addMachineType("Blast Furnace, BBF") |
| 68 | + .addInfo("Usable for Steel and general Pyrometallurgy") |
| 69 | + .addInfo("Has a useful interface, unlike other gregtech multis") |
| 70 | + .addPollutionAmount(GTMod.gregtechproxy.mPollutionPrimitveBlastFurnacePerSecond) |
| 71 | + .beginStructureBlock(7, 6, 7, false) |
| 72 | + .addController("Front center") |
| 73 | + .toolTipFinisher(); |
| 74 | + } |
| 75 | + return tooltipBuilder; |
| 76 | + } |
| 77 | + |
| 78 | + @Override |
| 79 | + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection aFacing, |
| 80 | + int colorIndex, boolean aActive, boolean redstoneLevel) { |
| 81 | + if (side == aFacing) { |
| 82 | + return aActive ? FACING_ACTIVE : FACING_FRONT; |
| 83 | + } |
| 84 | + return FACING_SIDE; |
| 85 | + } |
| 86 | + |
| 87 | + @Override |
| 88 | + public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { |
| 89 | + return new ETHBigCokeOven(this.mName); |
| 90 | + } |
| 91 | + |
| 92 | + @Override |
| 93 | + protected Block getCasingBlock() { |
| 94 | + return COKE_OVEN.getBlock(); |
| 95 | + } |
| 96 | + |
| 97 | + @Override |
| 98 | + protected int getCasingMetaID() { |
| 99 | + return 7; |
| 100 | + } |
| 101 | + |
| 102 | + @Override |
| 103 | + public String getName() { |
| 104 | + return "大型焦炉"; |
| 105 | + } |
| 106 | + |
| 107 | + @Override |
| 108 | + public SteamVariant getSteamVariant() { |
| 109 | + return SteamVariant.PRIMITIVE; |
| 110 | + } |
| 111 | + |
| 112 | + @Override |
| 113 | + public void getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, |
| 114 | + IWailaConfigHandler config) { |
| 115 | + super.getWailaBody(itemStack, currenttip, accessor, config); |
| 116 | + if (!this.getBaseMetaTileEntity() |
| 117 | + .isInvalidTileEntity()) { |
| 118 | + NBTTagCompound nbt = accessor.getNBTData(); |
| 119 | + currenttip.add( |
| 120 | + getMachineProgressString( |
| 121 | + this.getBaseMetaTileEntity() |
| 122 | + .isActive(), |
| 123 | + nbt.getInteger("mMaxProgressTime"), |
| 124 | + nbt.getInteger("mProgressTime"))); |
| 125 | + int level = nbt.getInteger("mLevel"); |
| 126 | + currenttip.add("最大并行数:" + (level + 4)); |
| 127 | + } |
| 128 | + } |
| 129 | + |
| 130 | + @Override |
| 131 | + public void getWailaNBTData(EntityPlayerMP player, TileEntity tile, NBTTagCompound tag, World world, int x, int y, |
| 132 | + int z) { |
| 133 | + super.getWailaNBTData(player, tile, tag, world, x, y, z); |
| 134 | + if (!this.getBaseMetaTileEntity() |
| 135 | + .isInvalidTileEntity()) { |
| 136 | + tag.setInteger("mProgressTime", this.getProgresstime()); |
| 137 | + tag.setInteger("mMaxProgressTime", this.maxProgresstime()); |
| 138 | + tag.setInteger("mLevel", this.getLevel()); |
| 139 | + } |
| 140 | + } |
| 141 | + |
| 142 | + @Override |
| 143 | + public String[] getStructureDescription(ItemStack stackSize) { |
| 144 | + return getTooltip().getStructureHint(); |
| 145 | + } |
| 146 | +} |
0 commit comments