More SonarQube fixes.
This commit is contained in:
@@ -21,9 +21,11 @@ import java.util.stream.IntStream;
|
|||||||
|
|
||||||
public final class IoUtil {
|
public final class IoUtil {
|
||||||
private static final Logger LOGGER = LogManager.getLogger(IoUtil.class);
|
private static final Logger LOGGER = LogManager.getLogger(IoUtil.class);
|
||||||
|
|
||||||
private static final int DEFAULT_EXTRACT_FLAGS = IComparer.COMPARE_NBT;
|
private static final int DEFAULT_EXTRACT_FLAGS = IComparer.COMPARE_NBT;
|
||||||
|
|
||||||
|
private IoUtil() {
|
||||||
|
}
|
||||||
|
|
||||||
public static IStackList<ItemStack> extractFromInternalItemStorage(IStackList<ItemStack> list, IStorageDisk<ItemStack> storage, Action action) {
|
public static IStackList<ItemStack> extractFromInternalItemStorage(IStackList<ItemStack> list, IStorageDisk<ItemStack> storage, Action action) {
|
||||||
IStackList<ItemStack> extracted = API.instance().createItemStackList();
|
IStackList<ItemStack> extracted = API.instance().createItemStackList();
|
||||||
|
|
||||||
|
@@ -7,9 +7,12 @@ import java.util.HashMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
public class ShapeCache {
|
public final class ShapeCache {
|
||||||
private static final Map<BlockState, VoxelShape> CACHE = new HashMap<>();
|
private static final Map<BlockState, VoxelShape> CACHE = new HashMap<>();
|
||||||
|
|
||||||
|
private ShapeCache() {
|
||||||
|
}
|
||||||
|
|
||||||
public static VoxelShape getOrCreate(BlockState state, Function<BlockState, VoxelShape> shapeFactory) {
|
public static VoxelShape getOrCreate(BlockState state, Function<BlockState, VoxelShape> shapeFactory) {
|
||||||
return CACHE.computeIfAbsent(state, shapeFactory);
|
return CACHE.computeIfAbsent(state, shapeFactory);
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,9 @@ public class NetworkNodeProxyCapability {
|
|||||||
@CapabilityInject(INetworkNodeProxy.class)
|
@CapabilityInject(INetworkNodeProxy.class)
|
||||||
public static final Capability<INetworkNodeProxy> NETWORK_NODE_PROXY_CAPABILITY = null;
|
public static final Capability<INetworkNodeProxy> NETWORK_NODE_PROXY_CAPABILITY = null;
|
||||||
|
|
||||||
|
private NetworkNodeProxyCapability() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void register() {
|
public static void register() {
|
||||||
CapabilityManager.INSTANCE.register(INetworkNodeProxy.class, new Storage(), new Factory());
|
CapabilityManager.INSTANCE.register(INetworkNodeProxy.class, new Storage(), new Factory());
|
||||||
|
|
||||||
|
@@ -13,6 +13,9 @@ import java.util.function.Predicate;
|
|||||||
public final class CraftingTweaksIntegration {
|
public final class CraftingTweaksIntegration {
|
||||||
private static final String ID = "craftingtweaks";
|
private static final String ID = "craftingtweaks";
|
||||||
|
|
||||||
|
private CraftingTweaksIntegration() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isLoaded() {
|
public static boolean isLoaded() {
|
||||||
return ModList.get().isLoaded(ID);
|
return ModList.get().isLoaded(ID);
|
||||||
}
|
}
|
||||||
|
@@ -5,6 +5,9 @@ import net.minecraftforge.fml.ModList;
|
|||||||
public class InventorySorterIntegration {
|
public class InventorySorterIntegration {
|
||||||
private static final String ID = "inventorysorter";
|
private static final String ID = "inventorysorter";
|
||||||
|
|
||||||
|
private InventorySorterIntegration() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isLoaded() {
|
public static boolean isLoaded() {
|
||||||
return ModList.get().isLoaded(ID);
|
return ModList.get().isLoaded(ID);
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,9 @@ package com.refinedmods.refinedstorage.integration.inventorytweaks;
|
|||||||
import net.minecraftforge.fml.ModList;
|
import net.minecraftforge.fml.ModList;
|
||||||
|
|
||||||
public class InventoryTweaksIntegration {
|
public class InventoryTweaksIntegration {
|
||||||
|
private InventoryTweaksIntegration() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isLoaded() {
|
public static boolean isLoaded() {
|
||||||
return ModList.get().isLoaded("inventorytweaks");
|
return ModList.get().isLoaded("inventorytweaks");
|
||||||
}
|
}
|
||||||
|
@@ -3,6 +3,9 @@ package com.refinedmods.refinedstorage.integration.jei;
|
|||||||
import net.minecraftforge.fml.ModList;
|
import net.minecraftforge.fml.ModList;
|
||||||
|
|
||||||
public final class JeiIntegration {
|
public final class JeiIntegration {
|
||||||
|
private JeiIntegration() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isLoaded() {
|
public static boolean isLoaded() {
|
||||||
return ModList.get().isLoaded("jei");
|
return ModList.get().isLoaded("jei");
|
||||||
}
|
}
|
||||||
|
@@ -11,6 +11,9 @@ import net.minecraft.client.gui.screen.Screen;
|
|||||||
import net.minecraft.util.text.TranslationTextComponent;
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
|
||||||
public class ClientProxy {
|
public class ClientProxy {
|
||||||
|
private ClientProxy() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void onReceivedCraftingPreviewResponseMessage(GridCraftingPreviewResponseMessage message) {
|
public static void onReceivedCraftingPreviewResponseMessage(GridCraftingPreviewResponseMessage message) {
|
||||||
Screen screen = Minecraft.getInstance().currentScreen;
|
Screen screen = Minecraft.getInstance().currentScreen;
|
||||||
|
|
||||||
|
@@ -11,4 +11,7 @@ public final class Styles {
|
|||||||
public static final Style RED = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.RED));
|
public static final Style RED = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.RED));
|
||||||
public static final Style BLUE = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.BLUE));
|
public static final Style BLUE = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.BLUE));
|
||||||
public static final Style AQUA = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.AQUA));
|
public static final Style AQUA = Style.EMPTY.setColor(Color.func_240744_a_(TextFormatting.AQUA));
|
||||||
|
|
||||||
|
private Styles() {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -17,6 +17,9 @@ import java.util.List;
|
|||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
|
|
||||||
public final class QuadTransformer {
|
public final class QuadTransformer {
|
||||||
|
private QuadTransformer() {
|
||||||
|
}
|
||||||
|
|
||||||
public static List<BakedQuad> getTransformedQuads(IBakedModel model, Direction facing, @Nullable Vector3f translation, BlockState state, Random rand, Direction side) {
|
public static List<BakedQuad> getTransformedQuads(IBakedModel model, Direction facing, @Nullable Vector3f translation, BlockState state, Random rand, Direction side) {
|
||||||
double r = Math.PI * (360 - facing.getOpposite().getHorizontalIndex() * 90) / 180d;
|
double r = Math.PI * (360 - facing.getOpposite().getHorizontalIndex() * 90) / 180d;
|
||||||
|
|
||||||
|
@@ -10,6 +10,9 @@ import java.util.List;
|
|||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
public final class GridFilterParser {
|
public final class GridFilterParser {
|
||||||
|
private GridFilterParser() {
|
||||||
|
}
|
||||||
|
|
||||||
public static List<Predicate<IGridStack>> getFilters(@Nullable IGrid grid, String query, List<IFilter> filters) {
|
public static List<Predicate<IGridStack>> getFilters(@Nullable IGrid grid, String query, List<IFilter> filters) {
|
||||||
List<Predicate<IGridStack>> gridFilters;
|
List<Predicate<IGridStack>> gridFilters;
|
||||||
|
|
||||||
|
@@ -12,6 +12,9 @@ import net.minecraftforge.fluids.FluidStack;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
public final class RSSerializers {
|
public final class RSSerializers {
|
||||||
|
private RSSerializers() {
|
||||||
|
}
|
||||||
|
|
||||||
public static final IDataSerializer<List<ClientNode>> CLIENT_NODE_SERIALIZER = new IDataSerializer<List<ClientNode>>() {
|
public static final IDataSerializer<List<ClientNode>> CLIENT_NODE_SERIALIZER = new IDataSerializer<List<ClientNode>>() {
|
||||||
@Override
|
@Override
|
||||||
public void write(PacketBuffer buf, List<ClientNode> nodes) {
|
public void write(PacketBuffer buf, List<ClientNode> nodes) {
|
||||||
|
@@ -6,6 +6,9 @@ import net.minecraft.nbt.CompoundNBT;
|
|||||||
public final class AccessTypeUtils {
|
public final class AccessTypeUtils {
|
||||||
private static final String NBT_ACCESS_TYPE = "AccessType";
|
private static final String NBT_ACCESS_TYPE = "AccessType";
|
||||||
|
|
||||||
|
private AccessTypeUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void writeAccessType(CompoundNBT tag, AccessType type) {
|
public static void writeAccessType(CompoundNBT tag, AccessType type) {
|
||||||
tag.putInt(NBT_ACCESS_TYPE, type.getId());
|
tag.putInt(NBT_ACCESS_TYPE, type.getId());
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
package com.refinedmods.refinedstorage.util;
|
package com.refinedmods.refinedstorage.util;
|
||||||
|
|
||||||
|
import net.minecraft.block.AbstractBlock;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.SoundType;
|
import net.minecraft.block.SoundType;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
@@ -7,8 +8,11 @@ import net.minecraft.util.text.ITextComponent;
|
|||||||
import net.minecraft.util.text.TranslationTextComponent;
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
|
|
||||||
public class BlockUtils {
|
public class BlockUtils {
|
||||||
public static final Block.Properties DEFAULT_ROCK_PROPERTIES = Block.Properties.create(Material.ROCK).hardnessAndResistance(1.9F).sound(SoundType.STONE);
|
public static final AbstractBlock.Properties DEFAULT_ROCK_PROPERTIES = AbstractBlock.Properties.create(Material.ROCK).hardnessAndResistance(1.9F).sound(SoundType.STONE);
|
||||||
public static final Block.Properties DEFAULT_GLASS_PROPERTIES = Block.Properties.create(Material.GLASS).sound(SoundType.GLASS).hardnessAndResistance(0.35F);
|
public static final AbstractBlock.Properties DEFAULT_GLASS_PROPERTIES = AbstractBlock.Properties.create(Material.GLASS).sound(SoundType.GLASS).hardnessAndResistance(0.35F);
|
||||||
|
|
||||||
|
private BlockUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
// Block#getTranslatedName is client only
|
// Block#getTranslatedName is client only
|
||||||
public static ITextComponent getBlockTranslation(Block block) {
|
public static ITextComponent getBlockTranslation(Block block) {
|
||||||
|
@@ -6,6 +6,9 @@ import net.minecraft.util.math.shapes.VoxelShape;
|
|||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
|
||||||
public final class CollisionUtils {
|
public final class CollisionUtils {
|
||||||
|
private CollisionUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static boolean isInBounds(VoxelShape shape, BlockPos pos, Vector3d hit) {
|
public static boolean isInBounds(VoxelShape shape, BlockPos pos, Vector3d hit) {
|
||||||
AxisAlignedBB aabb = shape.getBoundingBox().offset(pos);
|
AxisAlignedBB aabb = shape.getBoundingBox().offset(pos);
|
||||||
|
|
||||||
|
@@ -5,6 +5,9 @@ import net.minecraft.util.Direction;
|
|||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
|
||||||
public final class DirectionUtils {
|
public final class DirectionUtils {
|
||||||
|
private DirectionUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static Direction getFacingFromEntity(BlockPos clickedBlock, LivingEntity entity) {
|
public static Direction getFacingFromEntity(BlockPos clickedBlock, LivingEntity entity) {
|
||||||
return Direction.getFacingFromVector(
|
return Direction.getFacingFromVector(
|
||||||
(float) (entity.getPosX() - clickedBlock.getX()),
|
(float) (entity.getPosX() - clickedBlock.getX()),
|
||||||
|
@@ -8,6 +8,9 @@ import net.minecraft.tileentity.TileEntityType;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class FluidStorageBlockUtils {
|
public class FluidStorageBlockUtils {
|
||||||
|
private FluidStorageBlockUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static ResourceLocation getNetworkNodeId(FluidStorageType type) {
|
public static ResourceLocation getNetworkNodeId(FluidStorageType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case SIXTY_FOUR_K:
|
case SIXTY_FOUR_K:
|
||||||
|
@@ -8,6 +8,9 @@ import net.minecraft.tileentity.TileEntityType;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class GridUtils {
|
public class GridUtils {
|
||||||
|
private GridUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static ResourceLocation getNetworkNodeId(GridType type) {
|
public static ResourceLocation getNetworkNodeId(GridType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case NORMAL:
|
case NORMAL:
|
||||||
|
@@ -3,6 +3,9 @@ package com.refinedmods.refinedstorage.util;
|
|||||||
import net.minecraft.network.PacketBuffer;
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
|
||||||
public class PacketBufferUtils {
|
public class PacketBufferUtils {
|
||||||
|
private PacketBufferUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
// @Volatile: From PacketBuffer#readString, this exists because SideOnly
|
// @Volatile: From PacketBuffer#readString, this exists because SideOnly
|
||||||
public static String readString(PacketBuffer buffer) {
|
public static String readString(PacketBuffer buffer) {
|
||||||
return buffer.readString(32767);
|
return buffer.readString(32767);
|
||||||
|
@@ -26,6 +26,9 @@ import java.util.List;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
public final class RenderUtils {
|
public final class RenderUtils {
|
||||||
|
private RenderUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static String shorten(String text, int length) {
|
public static String shorten(String text, int length) {
|
||||||
if (text.length() > length) {
|
if (text.length() > length) {
|
||||||
text = text.substring(0, length) + "...";
|
text = text.substring(0, length) + "...";
|
||||||
|
@@ -44,6 +44,9 @@ public final class StackUtils {
|
|||||||
|
|
||||||
private static final Logger LOGGER = LogManager.getLogger(StackUtils.class);
|
private static final Logger LOGGER = LogManager.getLogger(StackUtils.class);
|
||||||
|
|
||||||
|
private StackUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
// @Volatile: from PacketBuffer#writeItemStack, with some tweaks to allow int stack counts
|
// @Volatile: from PacketBuffer#writeItemStack, with some tweaks to allow int stack counts
|
||||||
public static void writeItemStack(PacketBuffer buf, @Nonnull ItemStack stack) {
|
public static void writeItemStack(PacketBuffer buf, @Nonnull ItemStack stack) {
|
||||||
if (stack.isEmpty()) {
|
if (stack.isEmpty()) {
|
||||||
|
@@ -8,6 +8,9 @@ import net.minecraft.tileentity.TileEntityType;
|
|||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
public class StorageBlockUtils {
|
public class StorageBlockUtils {
|
||||||
|
private StorageBlockUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static ResourceLocation getNetworkNodeId(ItemStorageType type) {
|
public static ResourceLocation getNetworkNodeId(ItemStorageType type) {
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ONE_K:
|
case ONE_K:
|
||||||
|
@@ -10,6 +10,9 @@ public final class TimeUtils {
|
|||||||
private static final long WEEK = DAY * 7;
|
private static final long WEEK = DAY * 7;
|
||||||
private static final long YEAR = DAY * 365;
|
private static final long YEAR = DAY * 365;
|
||||||
|
|
||||||
|
private TimeUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static String getAgo(long ago, String by) {
|
public static String getAgo(long ago, String by) {
|
||||||
long diff = System.currentTimeMillis() - ago;
|
long diff = System.currentTimeMillis() - ago;
|
||||||
|
|
||||||
|
@@ -30,6 +30,9 @@ import javax.annotation.Nullable;
|
|||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
public final class WorldUtils {
|
public final class WorldUtils {
|
||||||
|
private WorldUtils() {
|
||||||
|
}
|
||||||
|
|
||||||
public static void updateBlock(@Nullable World world, BlockPos pos) {
|
public static void updateBlock(@Nullable World world, BlockPos pos) {
|
||||||
if (world != null && world.isBlockPresent(pos)) {
|
if (world != null && world.isBlockPresent(pos)) {
|
||||||
BlockState state = world.getBlockState(pos);
|
BlockState state = world.getBlockState(pos);
|
||||||
|
Reference in New Issue
Block a user