Code cleanup
This commit is contained in:
parent
48a6736a57
commit
f5b313f6a3
9 changed files with 20 additions and 13 deletions
|
@ -5,6 +5,8 @@ import cr0s.warpdrive.event.EMPReceiver;
|
|||
import cr0s.warpdrive.event.ItemHandler;
|
||||
import cr0s.warpdrive.event.LivingHandler;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
import java.util.WeakHashMap;
|
||||
|
@ -28,7 +30,8 @@ public class CommonProxy {
|
|||
|
||||
private static final WeakHashMap<GameProfile, WeakReference<EntityPlayer>> fakePlayers = new WeakHashMap<>(100);
|
||||
|
||||
private static EntityPlayerMP getPlayer(final WorldServer world, final UUID uuidPlayer) {
|
||||
@Nullable
|
||||
private static EntityPlayerMP getPlayer(@Nonnull final WorldServer world, final UUID uuidPlayer) {
|
||||
assert world.getMinecraftServer() != null;
|
||||
for (final EntityPlayerMP entityPlayerMP : world.getMinecraftServer().getPlayerList().getPlayers()) {
|
||||
if (entityPlayerMP.getUniqueID() == uuidPlayer) {
|
||||
|
@ -59,7 +62,7 @@ public class CommonProxy {
|
|||
}
|
||||
|
||||
public static boolean isBlockBreakCanceled(final UUID uuidPlayer, final BlockPos blockPosSource,
|
||||
final World world, final BlockPos blockPosEvent) {
|
||||
@Nonnull final World world, final BlockPos blockPosEvent) {
|
||||
if (world.isRemote || !(world instanceof WorldServer)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -84,7 +87,7 @@ public class CommonProxy {
|
|||
}
|
||||
|
||||
public static boolean isBlockPlaceCanceled(final UUID uuidPlayer, final BlockPos blockPosSource,
|
||||
final World world, final BlockPos blockPosEvent, final IBlockState blockState) {
|
||||
@Nonnull final World world, final BlockPos blockPosEvent, final IBlockState blockState) {
|
||||
if (world.isRemote || !(world instanceof WorldServer)) {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -678,6 +678,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
|
|||
return state();
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private Object[] scan() {
|
||||
// Already scanning?
|
||||
if (enumShipScannerState != EnumShipScannerState.IDLE) {
|
||||
|
@ -692,6 +693,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
|
|||
return new Object[] { success, 3, Commons.removeFormatting( reason.getUnformattedText() ) };
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private Object[] filename() {
|
||||
if (enumShipScannerState != EnumShipScannerState.IDLE && !schematicFileName.isEmpty()) {
|
||||
if (enumShipScannerState == EnumShipScannerState.DEPLOYING) {
|
||||
|
@ -704,6 +706,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
|
|||
return new Object[] { true, schematicFileName };
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private Object[] deploy(final Object[] arguments) {
|
||||
if (arguments == null || arguments.length != 5) {
|
||||
return new Object[] { false, "Invalid arguments count, you need <.schematic file name>, <offsetX>, <offsetY>, <offsetZ>, <rotationSteps>!" };
|
||||
|
@ -743,6 +746,7 @@ public class TileEntityShipScanner extends TileEntityAbstractMachine implements
|
|||
return new Object[] { isSuccess, Commons.removeFormatting( reason.getUnformattedText() ) };
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
private Object[] state() {
|
||||
switch (enumShipScannerState) {
|
||||
default:
|
||||
|
|
|
@ -159,7 +159,7 @@ public class TileEntityShipCore extends TileEntityAbstractShipController impleme
|
|||
if (ticksCooldown > 0) {
|
||||
ticksCooldown--;
|
||||
|
||||
// report coo down time when a command is requested
|
||||
// report cool down time when a command is requested
|
||||
if ( isEnabled
|
||||
&& isCommandConfirmed
|
||||
&& enumShipCommand.isMovement() ) {
|
||||
|
|
|
@ -41,7 +41,6 @@ public class CommandRender extends AbstractCommand {
|
|||
if (args.length > 0) {
|
||||
Commons.addChatMessage(commandSender, new TextComponentString(getUsage(commandSender)));
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
final EntityPlayerMP entityPlayer = commandSender instanceof EntityPlayerMP ? (EntityPlayerMP) commandSender : null;
|
||||
|
|
|
@ -155,6 +155,7 @@ public class ClassTransformer implements net.minecraft.launchwrapper.IClassTrans
|
|||
sizeClass.put(shortName, size + bytes.length);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
public static String getClientValidation() {
|
||||
final StringBuilder result = new StringBuilder().append(new Date().toString());
|
||||
for (final String key : countClass.keySet()) {
|
||||
|
|
|
@ -9,7 +9,6 @@ import cr0s.warpdrive.data.Vector3;
|
|||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.datasync.DataParameter;
|
||||
import net.minecraft.network.datasync.DataSerializers;
|
||||
|
|
|
@ -241,7 +241,7 @@ public class RenderCommons {
|
|||
renderer
|
||||
.pos( Float.intBitsToFloat(vData[size * i ]),
|
||||
Float.intBitsToFloat(vData[size * i + 1]),
|
||||
Float.intBitsToFloat(vData[size * i + 2]))
|
||||
Float.intBitsToFloat(vData[size * i + 2]) )
|
||||
.color(255, 255, 255, 255)
|
||||
.tex(Float.intBitsToFloat(vData[size * i + uv]), Float.intBitsToFloat(vData[size * i + uv + 1]))
|
||||
.lightmap(l1, l2)
|
||||
|
|
|
@ -8,6 +8,7 @@ import cr0s.warpdrive.data.CelestialObject.RenderData;
|
|||
import cr0s.warpdrive.data.StarMapRegistry;
|
||||
import cr0s.warpdrive.data.Vector3;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.awt.Color;
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -489,7 +490,7 @@ public class RenderSpaceSky extends IRenderHandler {
|
|||
|
||||
// colorization loosely inspired from Hertzsprung-Russell diagram
|
||||
// (we're using it for non-star objects too, so yeah...)
|
||||
private static int getStarColorRGB(final Random rand) {
|
||||
private static int getStarColorRGB(@Nonnull final Random rand) {
|
||||
final double colorType = rand.nextDouble();
|
||||
final float hue;
|
||||
final float saturation;
|
||||
|
|
Loading…
Reference in a new issue