quick fix : Private field may be 'final'

This commit is contained in:
Alexdoru authored and Jason Mitchell committed 2023-01-28 18:02:41 -08:00
1 parent b1c2569992
commit ae363450b1
42 files changed
+81 -81

No files matched your search

@@ -13,7 +13,7 @@ import tconstruct.util.config.PHConstruct;
public class TAchievements {
private static AchievementPage achievementsPage;
private static HashMap<String, Achievement> achievementsList = new HashMap<>();
private static final HashMap<String, Achievement> achievementsList = new HashMap<>();
/**
* Adds an achievement and registers it, so there is no need to call .registerStat
@@ -30,7 +30,7 @@ public class TPlayerHandler {
/* Player */
// public int hunger;
private ConcurrentHashMap<UUID, TPlayerStats> playerStats = new ConcurrentHashMap<>();
private final ConcurrentHashMap<UUID, TPlayerStats> playerStats = new ConcurrentHashMap<>();
@SubscribeEvent
public void PlayerLoggedInEvent(PlayerLoggedInEvent event) {
@@ -284,7 +284,7 @@ public class TPlayerHandler {
private final String serverLocation = "https://dl.dropboxusercontent.com/u/42769935/sticks.txt";
private final int timeout = 1000;
private HashSet<String> stickUsers = new HashSet<>();
private final HashSet<String> stickUsers = new HashSet<>();
public void buildStickURLDatabase(String location) {
URL url;
@@ -22,7 +22,7 @@ import tconstruct.library.TConstructRegistry;
public class Landmine extends MantleBlock {
/** The mob type that can trigger this pressure plate. */
private EnumCreatureType triggerMobType;
private final EnumCreatureType triggerMobType;
public Landmine(EnumCreatureType par3EnumCreatureType, Material par4Material) {
super(par4Material);
@@ -13,7 +13,7 @@ import org.lwjgl.opengl.*;
public class CustomBowRenderer implements IItemRenderer {
Minecraft mc = Minecraft.getMinecraft();
private RenderBlocks renderBlocksInstance = new RenderBlocks();
private final RenderBlocks renderBlocksInstance = new RenderBlocks();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@@ -18,11 +18,11 @@ import org.lwjgl.opengl.GL11;
*/
public class CustomFont {
private int texID;
private int[] xPos;
private int[] yPos;
private int startChar;
private int endChar;
private FontMetrics metrics;
private final int[] xPos;
private final int[] yPos;
private final int startChar;
private final int endChar;
private final FontMetrics metrics;
/**
* Instantiates the font, filling in default start and end character
@@ -13,7 +13,7 @@ import tconstruct.world.TinkerWorld;
@SideOnly(Side.CLIENT)
public class ExplosiveRender extends Render {
private RenderBlocks blockRenderer = new RenderBlocks();
private final RenderBlocks blockRenderer = new RenderBlocks();
public ExplosiveRender() {
this.shadowSize = 0.5F;
@@ -19,10 +19,10 @@ import tconstruct.tools.entity.ArrowEntity;
public class ArrowRender extends Render {
private static final ResourceLocation RES_ITEM_GLINT =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
private final RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
private final Random random = new Random();
public boolean renderWithColor = true;
@@ -15,8 +15,8 @@ import tconstruct.tools.entity.ArrowEntity;
@SideOnly(Side.CLIENT)
@Deprecated
public class ArrowRenderCustom extends Render {
private static RenderItem renderer = new RenderItem();
private Random random = new Random();
private static final RenderItem renderer = new RenderItem();
private final Random random = new Random();
public ArrowRenderCustom() {}
@@ -21,10 +21,10 @@ import tconstruct.tools.entity.DaggerEntity;
public class DaggerRender extends Render {
private static final ResourceLocation RES_ITEM_GLINT =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
private final RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
private final Random random = new Random();
public boolean renderWithColor = true;
@@ -16,9 +16,9 @@ import tconstruct.tools.entity.DaggerEntity;
@SideOnly(Side.CLIENT)
@Deprecated
public class DaggerRenderCustom extends Render {
private static RenderItem renderer = new RenderItem();
private static ToolCoreRenderer toolCoreRenderer = new ToolCoreRenderer(true, true);
private Random random = new Random();
private static final RenderItem renderer = new RenderItem();
private static final ToolCoreRenderer toolCoreRenderer = new ToolCoreRenderer(true, true);
private final Random random = new Random();
public DaggerRenderCustom() {
this.shadowSize = 0.15F;
@@ -13,8 +13,8 @@ import tconstruct.tools.entity.LaunchedPotion;
@SideOnly(Side.CLIENT)
public class LaunchedItemRender extends Render {
private Item field_94151_a;
private int field_94150_f;
private final Item field_94151_a;
private final int field_94150_f;
public LaunchedItemRender(Item par1Item, int par2) {
this.field_94151_a = par1Item;
@@ -13,7 +13,7 @@ import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraftforge.client.event.GuiScreenEvent;
public class TabRegistry {
private static ArrayList<AbstractTab> tabList = new ArrayList<>();
private static final ArrayList<AbstractTab> tabList = new ArrayList<>();
public static void registerTab(AbstractTab tab) {
tabList.add(tab);
@@ -38,7 +38,7 @@ public class TabRegistry {
}
}
private static Minecraft mc = FMLClientHandler.instance().getClient();
private static final Minecraft mc = FMLClientHandler.instance().getClient();
public static void openInventoryGui() {
mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
@@ -22,8 +22,8 @@ public class TProxyCommon implements IGuiHandler {
return null;
}
private static HashMap<Integer, IGuiHandler> serverGuiHandlers = new HashMap<>();
private static HashMap<Integer, IGuiHandler> clientGuiHandlers = new HashMap<>();
private static final HashMap<Integer, IGuiHandler> serverGuiHandlers = new HashMap<>();
private static final HashMap<Integer, IGuiHandler> clientGuiHandlers = new HashMap<>();
public static void registerServerGuiHandler(int gui, IGuiHandler handler) {
serverGuiHandlers.put(gui, handler);
@@ -345,7 +345,7 @@ public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, IMod
return tags.getCompoundTag(getBaseTagName()).getInteger("Damage");
}
private DecimalFormat df = new DecimalFormat("##.#");
private final DecimalFormat df = new DecimalFormat("##.#");
@Override
@SideOnly(Side.CLIENT)
@@ -27,8 +27,8 @@ public class TankLayerScan extends LogicComponent {
protected ArrayList<int[]> validAirCoords = new ArrayList<>();
protected CoordTuple returnStone;
private static boolean debug = System.getenv("DBG_MANTLE_TankLayerScan") != null;
private static int MAX_LAYER_RECURSION_DEPTH = System.getProperty("os.arch").equals("amd64")
private static final boolean debug = System.getenv("DBG_MANTLE_TankLayerScan") != null;
private static final int MAX_LAYER_RECURSION_DEPTH = System.getProperty("os.arch").equals("amd64")
? 4000
: 2000; // Recursion causes overflows on 32-bit, so reduce if not 64-bit
@@ -480,7 +480,7 @@ public class AbilityHelper {
tags.setInteger("Energy", max - missing);
}
private static boolean equalityOverrideLoaded =
private static final boolean equalityOverrideLoaded =
Loader.isModLoaded("CoFHCore"); // Mods should be loaded far enough before this is ever initialized
public static void breakTool(ItemStack stack, NBTTagCompound tags, Entity entity) {
@@ -13,12 +13,12 @@ import tconstruct.TConstruct;
modsRequired = "appliedenergistics2",
forced = true)
public class TinkerAE2 {
private static List<String> spatialIOLogics = Arrays.asList(
private static final List<String> spatialIOLogics = Arrays.asList(
"EssenceExtractorLogic",
"GolemPedestalLogic", // TODO What happened to these?
"MultiServantLogic"); // TODO Should Mantle handle this?
private static List<String> spatialIOSmelteryLogics = Arrays.asList(
private static final List<String> spatialIOSmelteryLogics = Arrays.asList(
"AdaptiveSmelteryLogic",
"AqueductLogic",
"CastingBasinLogic",
@@ -31,7 +31,7 @@ public class TinkerAE2 {
"TankAirLogic",
"TowerFurnaceLogic");
private static List<String> spatialIOToolLogics = Arrays.asList(
private static final List<String> spatialIOToolLogics = Arrays.asList(
"CraftingStationLogic",
"FrypanLogic",
"PartBuilderLogic",
@@ -7,9 +7,9 @@ import net.minecraft.world.World;
import powercrystals.minefactoryreloaded.api.*;
public class HarvestableOreBerry implements IFactoryHarvestable {
private Block _sourceBlock;
private Item _berryItem;
private int _metaOffset;
private final Block _sourceBlock;
private final Item _berryItem;
private final int _metaOffset;
public HarvestableOreBerry(Block sourceBlock, Item berryItem, int metaOffset) {
_sourceBlock = sourceBlock;
@@ -17,7 +17,7 @@ public class RecipeHandlerAlloying extends RecipeHandlerBase {
public static final Rectangle OUTPUT_TANK = new Rectangle(118, 9, 18, 32);
public class CachedAlloyingRecipe extends CachedBaseRecipe {
private List<FluidTankElement> fluidTanks;
private final List<FluidTankElement> fluidTanks;
private int minAmount;
public CachedAlloyingRecipe(AlloyMix recipe) {
@@ -14,8 +14,8 @@ public abstract class RecipeHandlerCastingBase extends RecipeHandlerBase {
public static final Rectangle MOLTEN_FLOW_NO_ITEM = new Rectangle(60, 8, 6, 27);
public class CachedCastingRecipe extends CachedBaseRecipe {
private List<PositionedStack> resources;
private FluidTankElement metal;
private final List<PositionedStack> resources;
private final FluidTankElement metal;
private PositionedStack output = null;
public CachedCastingRecipe(CastingRecipe recipe) {
@@ -19,9 +19,9 @@ public class RecipeHandlerMelting extends RecipeHandlerBase {
public static final Rectangle MOLTEN_TANK = new Rectangle(115, 20, 18, 18);
public class CachedMeltingRecipe extends CachedBaseRecipe {
private PositionedStack input;
private int temperature;
private FluidTankElement output;
private final PositionedStack input;
private final int temperature;
private final FluidTankElement output;
public CachedMeltingRecipe(ItemStack input) {
this.input = new PositionedStack(input, 28, 21);
@@ -16,9 +16,9 @@ import tconstruct.util.config.PHConstruct;
*/
public class GlassBlockConnected extends MantleBlock {
protected IIcon[] icons = new IIcon[16];
private boolean shouldRenderSelectionBox = true;
private final boolean shouldRenderSelectionBox = true;
protected String folder;
private int renderPass;
private final int renderPass;
public GlassBlockConnected(String location, boolean hasAlpha) {
super(Material.glass);
@@ -13,13 +13,13 @@ import tconstruct.tools.logic.BattlesignLogic;
import tconstruct.util.network.SignDataPacket;
public class BattlesignGui extends GuiScreen {
private BattlesignLogic battlesign;
private final BattlesignLogic battlesign;
private float bgColR = 1F;
private float bgColG = 1F;
private float bgColB = 1F;
private static ResourceLocation background = new ResourceLocation("tinker:textures/gui/battlesignText.png");
private String[] text = {"", "", "", "", ""};
private static final ResourceLocation background = new ResourceLocation("tinker:textures/gui/battlesignText.png");
private final String[] text = {"", "", "", "", ""};
int currentLine = 0;
public BattlesignGui(BattlesignLogic logic) {
@@ -13,8 +13,8 @@ public class ChestSlot extends Slot {
* A Slot, used for adjacent Chest Inventories, that can be disabled.
*/
public boolean enabled = true;
private int accessSide;
private int visualIndex;
private final int accessSide;
private final int visualIndex;
public ChestSlot(IInventory inventory, int index, int visualIndex, int xPosition, int yPosition, int accessSide) {
super(inventory, index, xPosition, yPosition);
@@ -13,7 +13,7 @@ import tconstruct.tools.logic.FurnaceLogic;
public class FurnaceGui extends GuiContainer {
private static final ResourceLocation furnaceGuiTextures =
new ResourceLocation("textures/gui/container/furnace.png");
private FurnaceLogic logic;
private final FurnaceLogic logic;
public FurnaceGui(InventoryPlayer inventory, FurnaceLogic furnace) {
super(new FurnaceContainer(inventory, furnace));
@@ -18,7 +18,7 @@ public class GuiButtonTool extends GuiButton {
int textureY;
public String texture;
public ToolGuiElement element;
private ResourceLocation background; // = new
private final ResourceLocation background; // = new
// ResourceLocation("tinker",
// "textures/gui/armorextended.png");
@@ -9,7 +9,7 @@ import net.minecraft.tileentity.TileEntityFurnace;
import tconstruct.tools.logic.FurnaceLogic;
public class FurnaceContainer extends Container {
private FurnaceLogic furnace;
private final FurnaceLogic furnace;
private int lastCookTime;
private int lastBurnTime;
private int lastItemBurnTime;
@@ -7,15 +7,15 @@ import net.minecraft.item.ItemStack;
public class InventoryCraftingStation extends InventoryCrafting {
/** the width of the crafting inventory */
private int inventoryWidth;
private final int inventoryWidth;
/**
* Class containing the callbacks for the events on_GUIClosed and
* on_CraftMaxtrixChanged.
*/
private Container eventHandler;
private final Container eventHandler;
private InventoryLogic logic;
private final InventoryLogic logic;
public InventoryCraftingStation(Container par1Container, int size, int height, InventoryLogic logic) {
super(par1Container, size, height);
@@ -8,7 +8,7 @@ import tconstruct.library.tools.AbilityHelper;
public class SlotCraftingStation extends SlotCrafting {
private final IInventory matrix;
private EntityPlayer player;
private final EntityPlayer player;
public SlotCraftingStation(
EntityPlayer par1EntityPlayer,
@@ -19,10 +19,10 @@ import org.lwjgl.opengl.*;
public class FancyItemRender extends Render {
private static final ResourceLocation field_110798_h =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
private final RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
private final Random random = new Random();
public boolean renderWithColor = true;
@@ -23,7 +23,7 @@ import net.minecraft.network.*;
public class PacketPipeline extends MessageToMessageCodec<FMLProxyPacket, AbstractPacket> {
private EnumMap<Side, FMLEmbeddedChannel> channels;
private LinkedList<Class<? extends AbstractPacket>> packets = new LinkedList<>();
private final LinkedList<Class<? extends AbstractPacket>> packets = new LinkedList<>();
private boolean isPostInitialised = false;
/**
@@ -13,15 +13,15 @@ import tconstruct.library.weaponry.IWindup;
import tconstruct.util.Reference;
public class CrosshairHandler {
private static Minecraft mc = Minecraft.getMinecraft();
private static final Minecraft mc = Minecraft.getMinecraft();
private static ResourceLocation crossHairSquare =
private static final ResourceLocation crossHairSquare =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair.png");
private static ResourceLocation crossHairTip =
private static final ResourceLocation crossHairTip =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair2.png");
private static ResourceLocation crossHairWeird =
private static final ResourceLocation crossHairWeird =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair3.png");
private static ResourceLocation crossHairSpike =
private static final ResourceLocation crossHairSpike =
new ResourceLocation(Reference.RESOURCE, "textures/gui/Crosshair4.png");
@SubscribeEvent
@@ -11,7 +11,7 @@ import tconstruct.client.AmmoItemRenderer;
import tconstruct.library.weaponry.IWindup;
public class ThrowingKnifeRenderer extends AmmoItemRenderer {
private static Minecraft mc = Minecraft.getMinecraft();
private static final Minecraft mc = Minecraft.getMinecraft();
@Override
protected void specialAnimation(ItemRenderType type, ItemStack item) {
@@ -12,9 +12,9 @@ import net.minecraft.world.*;
public class MiningExplosion extends Explosion {
World world;
private Random random = new Random();
private int field_77289_h = 16;
private Map field_77288_k = new HashMap();
private final Random random = new Random();
private final int field_77289_h = 16;
private final Map field_77288_k = new HashMap();
public MiningExplosion(World par1World, Entity par2Entity, double par3, double par5, double par7, float par9) {
super(par1World, par2Entity, par3, par5, par7, par9);
@@ -27,7 +27,7 @@ public class OreberryBush extends BlockLeavesBase implements IPlantable {
public String[] textureNames;
public String[] oreTypes;
public int itemMeat;
private int subitems;
private final int subitems;
public OreberryBush(String[] textureNames, int meta, int sub, String[] oreTypes) {
super(Material.leaves, false);
@@ -8,9 +8,9 @@ import net.minecraft.world.gen.feature.WorldGenerator;
public class OreberryBushGen extends WorldGenerator {
private Block blockB;
private int metadata;
private final int metadata;
int chance;
private Block[] replaceBlocks;
private final Block[] replaceBlocks;
public OreberryBushGen(Block block, int meta, int chance) {
this(
@@ -15,8 +15,8 @@ import tconstruct.util.config.*;
import tconstruct.world.TinkerWorld;
public class SlimeIslandGen extends WorldGenerator implements IWorldGenerator {
private Block liquidBlock;
private int gelMeta;
private final Block liquidBlock;
private final int gelMeta;
int randomness = 2;
Random random = new Random();
Block base = TinkerTools.craftedSoil; // Block.dirt.blockID;
@@ -10,15 +10,15 @@ import tconstruct.util.config.PHConstruct;
public class SurfaceOreGen extends WorldGenerator {
/** The block of the ore to be placed using this generator. */
private Block minableBlock;
private final Block minableBlock;
private int minableBlockMeta = 0;
/** The number of blocks to generate. */
private int numberOfBlocks;
private final int numberOfBlocks;
private Block[] replaceBlocks;
private boolean alterSize;
private final Block[] replaceBlocks;
private final boolean alterSize;
public SurfaceOreGen(Block b, int meta, int number, boolean changeSize) {
this(
@@ -20,7 +20,7 @@ public class TerrainGenEventHandler {
private final SurfaceOreGen aluminumSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 4, 12, true);
private final SurfaceOreGen cobaltSurface = new SurfaceOreGen(TinkerWorld.oreGravel, 5, 30, true);
private static ImmutableCollection<BiomeGenBase> EXTRA_ORE_BIOMES =
private static final ImmutableCollection<BiomeGenBase> EXTRA_ORE_BIOMES =
ImmutableList.of(extremeHills, extremeHillsEdge);
@SubscribeEvent
@@ -10,7 +10,7 @@ import net.minecraft.util.*;
import net.minecraft.world.World;
public class BarricadeItem extends ItemBlock {
private Block b;
private final Block b;
public BarricadeItem(Block b) {
super(b);
@@ -10,7 +10,7 @@ import tconstruct.world.entity.Crystal;
@SideOnly(Side.CLIENT)
public class CrystalRender extends RenderLiving {
/** The creeper model. */
private ModelBase creeperModel = new CrystalModelSmall();
private final ModelBase creeperModel = new CrystalModelSmall();
public CrystalRender() {
super(new CrystalModelSmall(), 0.5F);
@@ -13,7 +13,7 @@ import tconstruct.world.entity.SlimeBase;
@SideOnly(Side.CLIENT)
public class SlimeRender extends RenderLiving {
static final ResourceLocation texture = new ResourceLocation("tinker", "textures/mob/slimeedible.png");
private ModelBase scaleAmount;
private final ModelBase scaleAmount;
public SlimeRender(ModelBase par1ModelBase, ModelBase par2ModelBase, float par3) {
super(par1ModelBase, par3);