Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spotless apply for branch feature/turbine-overlay for #3550 #3551

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
spotlessApply
GitHub GTNH Actions committed Nov 24, 2024
commit 18ec7166f9a9a7ca2a442a87f5923e44c21ae61d
2 changes: 1 addition & 1 deletion src/main/java/gtPlusPlus/core/handler/PacketHandler.java
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

import static gregtech.api.enums.Mods.GTPlusPlus;

import gtPlusPlus.core.network.packet.PacketTurbineHatchUpdate;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;

@@ -11,6 +10,7 @@
import cpw.mods.fml.common.network.simpleimpl.SimpleNetworkWrapper;
import cpw.mods.fml.relauncher.Side;
import gtPlusPlus.core.network.handler.AbstractClientMessageHandler;
import gtPlusPlus.core.network.packet.PacketTurbineHatchUpdate;
import gtPlusPlus.core.network.packet.PacketVolumetricFlaskGui;
import gtPlusPlus.core.network.packet.PacketVolumetricFlaskGui2;

Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
package gtPlusPlus.core.network.packet;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;

import cpw.mods.fml.common.network.simpleimpl.IMessage;
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
import cpw.mods.fml.relauncher.Side;
import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.metatileentity.BaseMetaTileEntity;
import gtPlusPlus.GTplusplus;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.network.handler.AbstractClientMessageHandler;
import gtPlusPlus.core.tileentities.general.TileEntityVolumetricFlaskSetter;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.MTEHatchTurbine;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.MTELargerTurbineBase;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;

public class PacketTurbineHatchUpdate extends AbstractClientMessageHandler<PacketTurbineHatchUpdate>
implements AbstractPacket {
@@ -115,7 +110,8 @@ public String getPacketName() {

@Override
public IMessage handleClientMessage(EntityPlayer player, PacketTurbineHatchUpdate message, MessageContext ctx) {
TileEntity te = player.getEntityWorld().getTileEntity(message.x, message.y, message.z);
TileEntity te = player.getEntityWorld()
.getTileEntity(message.x, message.y, message.z);
if (!(te instanceof BaseMetaTileEntity mteHost)) return null;
IMetaTileEntity mte = mteHost.getMetaTileEntity();
if (!(mte instanceof MTEHatchTurbine hatch)) return null;
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations;

import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTUtilityClient;
import gtPlusPlus.core.handler.PacketHandler;
import gtPlusPlus.core.network.packet.PacketTurbineHatchUpdate;
import static gregtech.api.enums.Textures.BlockIcons.*;

import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.entity.player.EntityPlayer;
@@ -16,6 +12,7 @@

import org.apache.commons.lang3.ArrayUtils;

import com.gtnewhorizon.structurelib.alignment.enumerable.ExtendedFacing;
import com.gtnewhorizons.modularui.api.screen.ModularWindow;
import com.gtnewhorizons.modularui.api.screen.UIBuildContext;
import com.gtnewhorizons.modularui.common.widget.SlotWidget;
@@ -24,24 +21,26 @@
import gregtech.api.enums.Materials;
import gregtech.api.enums.SoundResource;
import gregtech.api.gui.modularui.GTUIInfos;
import gregtech.api.interfaces.IIconContainer;
import gregtech.api.interfaces.ITexture;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gregtech.api.items.MetaGeneratedTool;
import gregtech.api.metatileentity.MetaTileEntity;
import gregtech.api.metatileentity.implementations.MTEHatch;
import gregtech.api.objects.GTItemStack;
import gregtech.api.objects.GTRenderedTexture;
import gregtech.api.render.TextureFactory;
import gregtech.api.util.GTModHandler;
import gregtech.api.util.GTUtility;
import gregtech.api.util.GTUtilityClient;
import gtPlusPlus.api.objects.Logger;
import gtPlusPlus.api.objects.minecraft.BlockPos;
import gtPlusPlus.core.handler.PacketHandler;
import gtPlusPlus.core.lib.GTPPCore;
import gtPlusPlus.core.network.packet.PacketTurbineHatchUpdate;
import gtPlusPlus.core.util.math.MathUtils;
import gtPlusPlus.core.util.minecraft.PlayerUtils;
import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.production.turbines.MTELargerTurbineBase;

import static gregtech.api.enums.Textures.BlockIcons.*;

@SuppressWarnings("deprecation")
public class MTEHatchTurbine extends MTEHatch {

@@ -79,14 +78,13 @@ public String[] getDescription() {

@Override
public ITexture[] getTexturesActive(ITexture aBaseTexture) {
return new ITexture[] {aBaseTexture, TextureFactory.of(LARGETURBINE_NEW_ACTIVE5)};
return new ITexture[] { aBaseTexture, TextureFactory.of(LARGETURBINE_NEW_ACTIVE5) };
}

@Override
public ITexture[] getTexturesInactive(ITexture aBaseTexture) {
if (hasTurbine())
return new ITexture[] {aBaseTexture, TextureFactory.of(LARGETURBINE_NEW_EMPTY5)};
return new ITexture[] {aBaseTexture, TextureFactory.of(LARGETURBINE_NEW5)};
if (hasTurbine()) return new ITexture[] { aBaseTexture, TextureFactory.of(LARGETURBINE_NEW_EMPTY5) };
return new ITexture[] { aBaseTexture, TextureFactory.of(LARGETURBINE_NEW5) };
}

public int getEU() {
@@ -242,8 +240,7 @@ public MTELargerTurbineBase getController() {
if (this.mHasController && this.mControllerLocation != null) {
BlockPos p = mControllerLocation;
// Logger.INFO(p.getLocationString());
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity()
.getIGregTechTileEntity(p.xPos, p.yPos, p.zPos);
IGregTechTileEntity tTileEntity = getBaseMetaTileEntity().getIGregTechTileEntity(p.xPos, p.yPos, p.zPos);
if (tTileEntity != null && tTileEntity.getMetaTileEntity() instanceof MTELargerTurbineBase) {
return (MTELargerTurbineBase) tTileEntity.getMetaTileEntity();
} else {
@@ -297,8 +294,15 @@ public boolean renderInWorld(IBlockAccess aWorld, int aX, int aY, int aZ, Block
if (getBaseMetaTileEntity().isActive()) tTextures = getTurbineTextureActive();
else if (hasTurbine()) tTextures = getTurbineTextureFull();
else tTextures = getTurbineTextureEmpty();
GTUtilityClient
.renderTurbineOverlay(aWorld, aX, aY, aZ, aRenderer, ExtendedFacing.of(getBaseMetaTileEntity().getFrontFacing()), null, tTextures);
GTUtilityClient.renderTurbineOverlay(
aWorld,
aX,
aY,
aZ,
aRenderer,
ExtendedFacing.of(getBaseMetaTileEntity().getFrontFacing()),
null,
tTextures);
return false;
}

@@ -348,10 +352,7 @@ public void onScrewdriverRightClick(ForgeDirection side, EntityPlayer aPlayer, f
PlayerUtils.messagePlayer(aPlayer, "Using Animations? " + usingAnimations());
PlayerUtils.messagePlayer(aPlayer, "Has Controller? " + this.mHasController);
if (mHasController) {
PlayerUtils.messagePlayer(
aPlayer,
"Controller Location: " + mControllerLocation
.getLocationString());
PlayerUtils.messagePlayer(aPlayer, "Controller Location: " + mControllerLocation.getLocationString());
PlayerUtils.messagePlayer(aPlayer, "Controller Active? " + this.isControllerActive());
}
PlayerUtils.messagePlayer(
@@ -449,21 +450,17 @@ public boolean onToolClick(ItemStack tCurrentItem, EntityPlayer aPlayer, ForgeDi
@Override
public void addUIWidgets(ModularWindow.Builder builder, UIBuildContext buildContext) {
SlotWidget slot = new SlotWidget(inventoryHandler, 0).setFilter(MTELargerTurbineBase::isValidTurbine);
if (getBaseMetaTileEntity().isServerSide())
slot.setChangeListener(this::sendUpdate);
if (getBaseMetaTileEntity().isServerSide()) slot.setChangeListener(this::sendUpdate);
builder.widget(
slot
.setAccess(false, true)
slot.setAccess(false, true)
.setPos(79, 34));
}

public void receiveUpdate(PacketTurbineHatchUpdate message) {
mHasTurbine = message.isHasTurbine();
mFormed = message.isFormed();
if (message.getController() != null)
clearController();
else
setController(message.getController());
if (message.getController() != null) clearController();
else setController(message.getController());
getBaseMetaTileEntity().issueTextureUpdate();
}

@@ -475,7 +472,9 @@ public void sendUpdate() {
message.setFormed(mHasController && getController().mMachine);
message.setHasTurbine(hasTurbine());
message.setController(mControllerLocation);
PacketHandler.sendToAllAround(message, getBaseMetaTileEntity().getWorld().provider.dimensionId,
PacketHandler.sendToAllAround(
message,
getBaseMetaTileEntity().getWorld().provider.dimensionId,
getBaseMetaTileEntity().getXCoord(),
getBaseMetaTileEntity().getYCoord(),
getBaseMetaTileEntity().getZCoord(),
Original file line number Diff line number Diff line change
@@ -72,33 +72,11 @@
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE7;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE8;
import static gregtech.api.enums.Textures.BlockIcons.LARGETURBINE_TU_ACTIVE9;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE1;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE1_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE2;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE2_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE3;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE3_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE4;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE4_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE5;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE5_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE6;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE6_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE7;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE7_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE8;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE8_ACTIVE;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE9;
import static gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.OVERLAY_SC_TURBINE9_ACTIVE;

import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.common.util.ForgeDirection;

import gregtech.api.interfaces.metatileentity.IMetaTileEntity;
import gregtech.api.interfaces.tileentity.IGregTechTileEntity;
import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.MTEHatchTurbine;
import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaSpecialMultiCasings;

public class LargeTurbineTextureHandler {
@@ -151,7 +129,6 @@ public class LargeTurbineTextureHandler {
LARGETURBINE_TU_ACTIVE5.getIcon(), LARGETURBINE_TU_ACTIVE6.getIcon(), LARGETURBINE_TU_ACTIVE7.getIcon(),
LARGETURBINE_TU_ACTIVE8.getIcon(), LARGETURBINE_TU_ACTIVE9.getIcon(), };


public static IIcon handleCasingsGT(final IBlockAccess aWorld, final int xCoord, final int yCoord, final int zCoord,
final ForgeDirection side, final GregtechMetaSpecialMultiCasings i) {
final int tMeta = aWorld.getBlockMetadata(xCoord, yCoord, zCoord);