mirror of
https://github.com/GTNewHorizons/StorageDrawers.git
synced 2026-11-20 20:22:22 +00:00
Apply spotless
This commit is contained in:
1 parent
119e8eff03
commit
2f77f44ab3
9 files changed
+66
-54
No files matched your search
+1
-1
@@ -37,7 +37,7 @@ remoteMappings = https\://raw.githubusercontent.com/MinecraftForge/FML/1.7.10/co
|
||||
|
||||
# Select a default username for testing your mod. You can always override this per-run by running
|
||||
# `./gradlew runClient --username=AnotherPlayer`, or configuring this command in your IDE.
|
||||
developmentEnvironmentUserName = "Developer"
|
||||
developmentEnvironmentUserName = "cargocat"
|
||||
|
||||
# Enables using modern Java syntax (up to version 17) via Jabel, while still targeting JVM 8.
|
||||
# See https://github.com/bsideup/jabel for details on how this works.
|
||||
|
||||
+1
-1
@@ -14,7 +14,6 @@ import java.util.Queue;
|
||||
import java.util.Set;
|
||||
import java.util.UUID;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
@@ -35,6 +34,7 @@ import com.jaquadro.minecraft.storagedrawers.api.storage.IFractionalDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.INetworked;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IPriorityGroup;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.ISmartGroup;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.BlockSlave;
|
||||
import com.jaquadro.minecraft.storagedrawers.security.SecurityManager;
|
||||
|
||||
+26
-11
@@ -2,11 +2,9 @@ package com.jaquadro.minecraft.storagedrawers.client.renderer;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.util.CountFormatter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.renderer.OpenGlHelper;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
@@ -18,7 +16,6 @@ import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -36,6 +33,7 @@ import com.jaquadro.minecraft.storagedrawers.api.render.IRenderLabel;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.BlockDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.block.tile.TileEntityDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.util.CountFormatter;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameData;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
@@ -389,21 +387,37 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
|
||||
break;
|
||||
case 4:
|
||||
switch (slot) {
|
||||
case 0: offsetX = 4; offsetY = 6; break;
|
||||
case 1: offsetX = 4; break;
|
||||
case 2: offsetX = 12; offsetY = 6; break;
|
||||
case 3: offsetX = 12; break;
|
||||
case 0:
|
||||
offsetX = 4;
|
||||
offsetY = 6;
|
||||
break;
|
||||
case 1:
|
||||
offsetX = 4;
|
||||
break;
|
||||
case 2:
|
||||
offsetX = 12;
|
||||
offsetY = 6;
|
||||
break;
|
||||
case 3:
|
||||
offsetX = 12;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if (block.halfDepth) depth += 1;
|
||||
|
||||
renderText(CountFormatter.format(this.func_147498_b(), tile.getDrawer(slot)), side, offsetX, offsetY, depth - 1f, alpha);
|
||||
renderText(
|
||||
CountFormatter.format(this.func_147498_b(), tile.getDrawer(slot)),
|
||||
side,
|
||||
offsetX,
|
||||
offsetY,
|
||||
depth - 1f,
|
||||
alpha);
|
||||
}
|
||||
|
||||
|
||||
private void renderText(String renderString, ForgeDirection side, float offsetX, float offsetY, float offsetZ, float alpha) {
|
||||
private void renderText(String renderString, ForgeDirection side, float offsetX, float offsetY, float offsetZ,
|
||||
float alpha) {
|
||||
int stringWidth = this.func_147498_b().getStringWidth(renderString);
|
||||
|
||||
GL11.glPushMatrix();
|
||||
@@ -415,7 +429,8 @@ public class TileEntityDrawersRenderer extends TileEntitySpecialRenderer {
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
this.func_147498_b().drawString(renderString, -stringWidth / 2, 0, (int)(255 * alpha) << 24 | 255 << 16 | 255 << 8 | 255);
|
||||
this.func_147498_b()
|
||||
.drawString(renderString, -stringWidth / 2, 0, (int) (255 * alpha) << 24 | 255 << 16 | 255 << 8 | 255);
|
||||
|
||||
GL11.glDepthMask(true);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.core;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.item.*;
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.StorageDrawers;
|
||||
import com.jaquadro.minecraft.storagedrawers.item.*;
|
||||
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
|
||||
|
||||
@@ -399,7 +399,8 @@ public class ModRecipes {
|
||||
}
|
||||
|
||||
if (config.cache.enableQuantifyUpgrades) {
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.quantifyKey), ModItems.upgradeLock, Items.writable_book);
|
||||
GameRegistry
|
||||
.addShapelessRecipe(new ItemStack(ModItems.quantifyKey), ModItems.upgradeLock, Items.writable_book);
|
||||
}
|
||||
|
||||
if (config.cache.enableTape) {
|
||||
|
||||
@@ -1,14 +1,15 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IFractionalDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
|
||||
|
||||
public class CompDrawerData extends BaseDrawerData implements IFractionalDrawer, IVoidable, IShroudable, ILockable, IQuantifiable {
|
||||
public class CompDrawerData extends BaseDrawerData
|
||||
implements IFractionalDrawer, IVoidable, IShroudable, ILockable, IQuantifiable {
|
||||
|
||||
private static final ItemStack nullStack = new ItemStack((Item) null);
|
||||
|
||||
|
||||
+6
-2
@@ -64,10 +64,14 @@ public class DefaultStorageProvider implements IStorageProvider {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQuantified(int slot) { return false; }
|
||||
public boolean isQuantified(int slot) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean setIsQuantified(int slot, boolean state) { return false; }
|
||||
public boolean setIsQuantified(int slot, boolean state) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isStorageUnlimited(int slot) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.storage;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -8,6 +7,7 @@ import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.event.DrawerPopulatedEvent;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.attribute.*;
|
||||
|
||||
public class DrawerData extends BaseDrawerData implements IVoidable, IShroudable, ILockable, IQuantifiable {
|
||||
|
||||
@@ -205,7 +205,9 @@ public class DrawerData extends BaseDrawerData implements IVoidable, IShroudable
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isQuantified() { return storageProvider.isQuantified(slot); }
|
||||
public boolean isQuantified() {
|
||||
return storageProvider.isQuantified(slot);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setIsQuantified(boolean state) {}
|
||||
|
||||
@@ -1,62 +1,51 @@
|
||||
package com.jaquadro.minecraft.storagedrawers.util;
|
||||
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
|
||||
public class CountFormatter
|
||||
{
|
||||
public static String format (FontRenderer font, IDrawer drawer) {
|
||||
import com.jaquadro.minecraft.storagedrawers.api.storage.IDrawer;
|
||||
|
||||
public class CountFormatter {
|
||||
|
||||
public static String format(FontRenderer font, IDrawer drawer) {
|
||||
return formatApprox(font, drawer);
|
||||
}
|
||||
|
||||
public static String formatStackNotation (IDrawer drawer) {
|
||||
if (drawer == null || drawer.isEmpty())
|
||||
return "";
|
||||
public static String formatStackNotation(IDrawer drawer) {
|
||||
if (drawer == null || drawer.isEmpty()) return "";
|
||||
|
||||
String text;
|
||||
int stacks = drawer.getStoredItemCount() / drawer.getStoredItemStackSize();
|
||||
int remainder = drawer.getStoredItemCount() - (stacks * drawer.getStoredItemStackSize());
|
||||
|
||||
if (stacks > 0 && remainder > 0)
|
||||
text = stacks + "x" + drawer.getStoredItemStackSize() + "+" + remainder;
|
||||
else if (stacks > 0)
|
||||
text = stacks + "x" + drawer.getStoredItemStackSize();
|
||||
else
|
||||
text = String.valueOf(remainder);
|
||||
if (stacks > 0 && remainder > 0) text = stacks + "x" + drawer.getStoredItemStackSize() + "+" + remainder;
|
||||
else if (stacks > 0) text = stacks + "x" + drawer.getStoredItemStackSize();
|
||||
else text = String.valueOf(remainder);
|
||||
|
||||
return text;
|
||||
}
|
||||
|
||||
public static String formatExact (IDrawer drawer) {
|
||||
if (drawer == null || drawer.isEmpty())
|
||||
return "";
|
||||
public static String formatExact(IDrawer drawer) {
|
||||
if (drawer == null || drawer.isEmpty()) return "";
|
||||
|
||||
return String.valueOf(drawer.getStoredItemCount());
|
||||
}
|
||||
|
||||
public static String formatApprox (FontRenderer font, IDrawer drawer) {
|
||||
if (drawer == null || drawer.isEmpty())
|
||||
return "";
|
||||
public static String formatApprox(FontRenderer font, IDrawer drawer) {
|
||||
if (drawer == null || drawer.isEmpty()) return "";
|
||||
|
||||
return formatApprox(font, drawer.getStoredItemCount());
|
||||
}
|
||||
|
||||
public static String formatApprox (FontRenderer font, int count) {
|
||||
public static String formatApprox(FontRenderer font, int count) {
|
||||
String text;
|
||||
|
||||
if (count >= 1000000000)
|
||||
text = String.format("%.1fG", count / 1000000000f);
|
||||
else if (count >= 100000000)
|
||||
text = String.format("%.0fM", count / 1000000f);
|
||||
else if (count >= 1000000)
|
||||
text = String.format("%.1fM", count / 1000000f);
|
||||
else if (count >= 100000)
|
||||
text = String.format("%.0fK", count / 1000f);
|
||||
else if (count >= 10000)
|
||||
text = String.format("%.1fK", count / 1000f);
|
||||
else
|
||||
text = String.valueOf(count);
|
||||
if (count >= 1000000000) text = String.format("%.1fG", count / 1000000000f);
|
||||
else if (count >= 100000000) text = String.format("%.0fM", count / 1000000f);
|
||||
else if (count >= 1000000) text = String.format("%.1fM", count / 1000000f);
|
||||
else if (count >= 100000) text = String.format("%.0fK", count / 1000f);
|
||||
else if (count >= 10000) text = String.format("%.1fK", count / 1000f);
|
||||
else text = String.valueOf(count);
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user