aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java
diff options
context:
space:
mode:
authorNotAPenguin <michiel.vandeginste@gmail.com>2024-09-02 23:17:17 +0200
committerGitHub <noreply@github.com>2024-09-02 23:17:17 +0200
commit1b820de08a05070909a267e17f033fcf58ac8710 (patch)
tree02831a025986a06b20f87e5bcc69d1e0c639a342 /src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java
parentafd3fd92b6a6ab9ab0d0dc3214e6bc8ff7a86c9b (diff)
downloadGT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.gz
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.tar.bz2
GT5-Unofficial-1b820de08a05070909a267e17f033fcf58ac8710.zip
The Great Renaming (#3014)
* move kekztech to a single root dir * move detrav to a single root dir * move gtnh-lanthanides to a single root dir * move tectech and delete some gross reflection in gt++ * remove more reflection inside gt5u * delete more reflection in gt++ * fix imports * move bartworks and bwcrossmod * fix proxies * move galactigreg and ggfab * move gtneioreplugin * try to fix gt++ bee loader * apply the rename rules to BW * apply rename rules to bwcrossmod * apply rename rules to detrav scanner mod * apply rename rules to galacticgreg * apply rename rules to ggfab * apply rename rules to goodgenerator * apply rename rules to gtnh-lanthanides * apply rename rules to gt++ * apply rename rules to kekztech * apply rename rules to kubatech * apply rename rules to tectech * apply rename rules to gt apply the rename rules to gt * fix tt import * fix mui hopefully * fix coremod except intergalactic * rename assline recipe class * fix a class name i stumbled on * rename StructureUtility to GTStructureUtility to prevent conflict with structurelib * temporary rename of GTTooltipDataCache to old name * fix gt client/server proxy names
Diffstat (limited to 'src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java')
-rw-r--r--src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java217
1 files changed, 217 insertions, 0 deletions
diff --git a/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java b/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java
new file mode 100644
index 0000000000..d70a0e3c43
--- /dev/null
+++ b/src/main/java/tectech/thing/metaTileEntity/single/MTEDebugPollutor.java
@@ -0,0 +1,217 @@
+package tectech.thing.metaTileEntity.single;
+
+import static net.minecraft.util.StatCollector.translateToLocal;
+
+import java.util.function.Consumer;
+
+import net.minecraft.client.renderer.texture.IIconRegister;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import net.minecraft.nbt.NBTTagCompound;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.common.util.ForgeDirection;
+
+import com.gtnewhorizons.modularui.api.NumberFormatMUI;
+import com.gtnewhorizons.modularui.api.drawable.IDrawable;
+import com.gtnewhorizons.modularui.api.screen.ModularWindow;
+import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
+import com.gtnewhorizons.modularui.common.widget.ButtonWidget;
+import com.gtnewhorizons.modularui.common.widget.DrawableWidget;
+import com.gtnewhorizons.modularui.common.widget.TextWidget;
+
+import cpw.mods.fml.relauncher.Side;
+import cpw.mods.fml.relauncher.SideOnly;
+import gregtech.api.enums.Textures;
+import gregtech.api.gui.modularui.GTUIInfos;
+import gregtech.api.gui.modularui.GTUITextures;
+import gregtech.api.interfaces.ITexture;
+import gregtech.api.interfaces.modularui.IAddGregtechLogo;
+import gregtech.api.interfaces.modularui.IAddUIWidgets;
+import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
+import gregtech.api.metatileentity.MetaTileEntity;
+import gregtech.api.metatileentity.implementations.MTETieredMachineBlock;
+import gregtech.api.objects.GTRenderedTexture;
+import gregtech.common.Pollution;
+import tectech.TecTech;
+import tectech.util.CommonValues;
+import tectech.util.TTUtility;
+
+/**
+ * Created by Tec on 23.03.2017.
+ */
+public class MTEDebugPollutor extends MTETieredMachineBlock implements IAddUIWidgets, IAddGregtechLogo {
+
+ private static GTRenderedTexture POLLUTOR;
+ public int pollution = 0;
+ private static final NumberFormatMUI numberFormat = new NumberFormatMUI();
+
+ public MTEDebugPollutor(int aID, String aName, String aNameRegional, int aTier) {
+ super(
+ aID,
+ aName,
+ aNameRegional,
+ aTier,
+ 0,
+ new String[] { CommonValues.TEC_MARK_GENERAL, translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.0"),
+ EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.1"),
+ EnumChatFormatting.BLUE + translateToLocal("gt.blockmachines.debug.tt.pollutor.desc.2") });
+ TTUtility.setTier(aTier, this);
+ }
+
+ public MTEDebugPollutor(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) {
+ super(aName, aTier, 0, aDescription, aTextures);
+ TTUtility.setTier(aTier, this);
+ }
+
+ @Override
+ public MetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) {
+ return new MTEDebugPollutor(mName, mTier, mDescriptionArray, mTextures);
+ }
+
+ @Override
+ @SideOnly(Side.CLIENT)
+ public void registerIcons(IIconRegister aBlockIconRegister) {
+ super.registerIcons(aBlockIconRegister);
+ POLLUTOR = new GTRenderedTexture(new Textures.BlockIcons.CustomIcon("iconsets/POLLUTOR"));
+ }
+
+ @Override
+ public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, ForgeDirection side, ForgeDirection facing,
+ int colorIndex, boolean aActive, boolean aRedstone) {
+ return new ITexture[] { tectech.thing.metaTileEntity.Textures.MACHINE_CASINGS_TT[mTier][colorIndex + 1],
+ (side == facing) ? POLLUTOR : tectech.thing.metaTileEntity.Textures.OVERLAYS_ENERGY_OUT_LASER_TT[mTier] };
+ }
+
+ @Override
+ public ITexture[][][] getTextureSet(ITexture[] aTextures) {
+ return null;
+ }
+
+ @Override
+ public boolean allowPutStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side,
+ ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public boolean allowPullStack(IGregTechTileEntity iGregTechTileEntity, int i, ForgeDirection side,
+ ItemStack itemStack) {
+ return false;
+ }
+
+ @Override
+ public void saveNBTData(NBTTagCompound aNBT) {
+ aNBT.setInteger("ePollution", pollution);
+ }
+
+ @Override
+ public void loadNBTData(NBTTagCompound aNBT) {
+ pollution = aNBT.getInteger("ePollution");
+ }
+
+ @Override
+ public boolean isSimpleMachine() {
+ return false;
+ }
+
+ @Override
+ public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) {
+ if (aBaseMetaTileEntity.isServerSide()) {
+ if (pollution > 0) {
+ Pollution.addPollution(aBaseMetaTileEntity, pollution);
+ }
+ } else if (aBaseMetaTileEntity.isClientSide() && aBaseMetaTileEntity.isActive()) {
+ for (final ForgeDirection side : ForgeDirection.VALID_DIRECTIONS) {
+ if (side != aBaseMetaTileEntity.getFrontFacing()) {
+ TecTech.proxy.em_particle(aBaseMetaTileEntity, side);
+ TecTech.proxy.pollutor_particle(aBaseMetaTileEntity, side);
+ }
+ }
+ }
+ }
+
+ @Override
+ public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) {
+ GTUIInfos.openGTTileEntityUI(aBaseMetaTileEntity, aPlayer);
+ return true;
+ }
+
+ @Override
+ public boolean isFacingValid(ForgeDirection facing) {
+ return true;
+ }
+
+ @Override
+ public boolean isAccessAllowed(EntityPlayer aPlayer) {
+ return true;
+ }
+
+ @Override
+ public boolean isElectric() {
+ return false;
+ }
+
+ @Override
+ public void addGregTechLogo(ModularWindow.Builder builder) {
+ builder.widget(
+ new DrawableWidget().setDrawable(GTUITextures.PICTURE_GT_LOGO_17x17_TRANSPARENT_GRAY)
+ .setSize(17, 17)
+ .setPos(113, 56));
+ }
+
+ @Override
+ public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
+ builder.widget(
+ new DrawableWidget().setDrawable(GTUITextures.PICTURE_SCREEN_BLACK)
+ .setSize(90, 72)
+ .setPos(43, 4))
+ .widget(
+ new TextWidget().setStringSupplier(() -> "Pollution: " + numberFormat.format(pollution))
+ .setDefaultColor(COLOR_TEXT_WHITE.get())
+ .setPos(46, 8));
+
+ addChangeNumberButton(builder, GTUITextures.OVERLAY_BUTTON_MINUS_LARGE, val -> pollution -= val, 512, 64, 7, 4);
+ addChangeNumberButton(
+ builder,
+ GTUITextures.OVERLAY_BUTTON_MINUS_LARGE,
+ val -> pollution /= val,
+ 512,
+ 64,
+ 7,
+ 22);
+
+ addChangeNumberButton(builder, GTUITextures.OVERLAY_BUTTON_MINUS_SMALL, val -> pollution -= val, 16, 1, 25, 4);
+ addChangeNumberButton(builder, GTUITextures.OVERLAY_BUTTON_MINUS_SMALL, val -> pollution /= val, 16, 2, 25, 22);
+
+ addChangeNumberButton(builder, GTUITextures.OVERLAY_BUTTON_PLUS_SMALL, val -> pollution += val, 16, 1, 133, 4);
+ addChangeNumberButton(builder, GTUITextures.OVERLAY_BUTTON_PLUS_SMALL, val -> pollution *= val, 16, 2, 133, 22);
+
+ addChangeNumberButton(
+ builder,
+ GTUITextures.OVERLAY_BUTTON_PLUS_LARGE,
+ val -> pollution += val,
+ 512,
+ 64,
+ 151,
+ 4);
+ addChangeNumberButton(
+ builder,
+ GTUITextures.OVERLAY_BUTTON_PLUS_LARGE,
+ val -> pollution *= val,
+ 512,
+ 64,
+ 151,
+ 22);
+
+ }
+
+ private void addChangeNumberButton(ModularWindow.Builder builder, IDrawable overlay, Consumer<Integer> setter,
+ int changeNumberShift, int changeNumber, int xPos, int yPos) {
+ builder.widget(
+ new ButtonWidget()
+ .setOnClick((clickData, widget) -> setter.accept(clickData.shift ? changeNumberShift : changeNumber))
+ .setBackground(GTUITextures.BUTTON_STANDARD, overlay)
+ .setSize(18, 18)
+ .setPos(xPos, yPos));
+ }
+}