From c0aa4c7eef4f97c1ef9a8af7eaf2afe2feffd3d0 Mon Sep 17 00:00:00 2001 From: fred-boy Date: Mon, 23 Dec 2019 15:28:31 +0700 Subject: [PATCH] Nonnull by default --- core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java | 7 +++---- core/src/ru/deadsoftware/cavedroid/game/GameSaver.java | 9 ++++----- core/src/ru/deadsoftware/cavedroid/game/GameWorld.java | 3 +-- .../deadsoftware/cavedroid/game/mobs/FallingGravel.java | 3 +-- .../ru/deadsoftware/cavedroid/game/mobs/FallingSand.java | 3 +-- .../deadsoftware/cavedroid/game/mobs/package-info.java | 4 ++++ .../cavedroid/game/objects/package-info.java | 4 ++++ .../src/ru/deadsoftware/cavedroid/game/package-info.java | 4 ++++ .../cavedroid/menu/objects/package-info.java | 4 ++++ .../src/ru/deadsoftware/cavedroid/menu/package-info.java | 4 ++++ .../cavedroid/menu/submenus/package-info.java | 4 ++++ .../src/ru/deadsoftware/cavedroid/misc/package-info.java | 4 ++++ .../deadsoftware/cavedroid/misc/states/package-info.java | 4 ++++ core/src/ru/deadsoftware/cavedroid/package-info.java | 4 ++++ 14 files changed, 46 insertions(+), 15 deletions(-) create mode 100644 core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/game/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/menu/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/misc/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/misc/states/package-info.java create mode 100644 core/src/ru/deadsoftware/cavedroid/package-info.java diff --git a/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java b/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java index ed31da7..8ebb260 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GamePhysics.java @@ -4,7 +4,6 @@ import com.badlogic.gdx.math.Intersector; import com.badlogic.gdx.math.MathUtils; import com.badlogic.gdx.math.Rectangle; import com.badlogic.gdx.math.Vector2; -import org.jetbrains.annotations.NotNull; import ru.deadsoftware.cavedroid.CaveGame; import ru.deadsoftware.cavedroid.game.mobs.Mob; import ru.deadsoftware.cavedroid.game.mobs.Player; @@ -25,7 +24,7 @@ class GamePhysics { * * @return true if mob should jump */ - private boolean checkJump(@NotNull Mob mob) { + private boolean checkJump(Mob mob) { int dir = mob.looksLeft() ? 0 : 1; int blX = (int) (mob.getX() + mob.getWidth() * dir - 8 + 16 * dir); int blY = (int) (mob.getY() + mob.getHeight() - 8); @@ -39,7 +38,7 @@ class GamePhysics { (mob.getY() + mob.getHeight()) - GameItems.getBlock(block).getRect(blX / 16, blY / 16).y > 8); } - private boolean checkColl(@NotNull Rectangle rect) { + private boolean checkColl(Rectangle rect) { int minX = (int) ((rect.x + rect.width / 2) / 16) - 4; int minY = (int) ((rect.y + rect.height / 2) / 16) - 4; int maxX = (int) ((rect.x + rect.width / 2) / 16) + 4; @@ -68,7 +67,7 @@ class GamePhysics { return false; } - private int getBlock(@NotNull Rectangle rect) { + private int getBlock(Rectangle rect) { return GP.world.getForeMap((int) (rect.x + rect.width / 2) / 16, (int) (rect.y + rect.height / 8 * 7) / 16); } diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameSaver.java b/core/src/ru/deadsoftware/cavedroid/game/GameSaver.java index 4982286..38e2959 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameSaver.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameSaver.java @@ -2,7 +2,6 @@ package ru.deadsoftware.cavedroid.game; import com.badlogic.gdx.Gdx; import com.badlogic.gdx.files.FileHandle; -import org.jetbrains.annotations.NotNull; import ru.deadsoftware.cavedroid.CaveGame; import java.io.*; @@ -12,12 +11,12 @@ public class GameSaver { private static final int VERSION = 0; - @NotNull + private static byte[] intToBytes(int i) { return ByteBuffer.allocate(4).putInt(i).array(); } - private static void saveMap(@NotNull FileHandle file, @NotNull int[][] map) throws IOException { + private static void saveMap(FileHandle file, int[][] map) throws IOException { int rl, bl; int width = map.length; int height = map[0].length; @@ -44,8 +43,8 @@ public class GameSaver { out.close(); } - @NotNull - private static int[][] loadMap(@NotNull FileHandle file) throws Exception { + + private static int[][] loadMap(FileHandle file) throws Exception { int[][] map; int ver, width, height; int rl, bl; diff --git a/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java b/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java index 0c44350..01ddee9 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java +++ b/core/src/ru/deadsoftware/cavedroid/game/GameWorld.java @@ -1,6 +1,5 @@ package ru.deadsoftware.cavedroid.game; -import org.jetbrains.annotations.NotNull; import ru.deadsoftware.cavedroid.game.objects.Block; import ru.deadsoftware.cavedroid.game.objects.Drop; @@ -23,7 +22,7 @@ public class GameWorld { WorldGen.clear(); } - GameWorld(@NotNull int[][] foreMap, @NotNull int[][] backMap) { + GameWorld(int[][] foreMap, int[][] backMap) { this.foreMap = foreMap.clone(); this.backMap = backMap.clone(); WIDTH = foreMap.length; diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java index fb56704..c46def3 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingGravel.java @@ -2,7 +2,6 @@ package ru.deadsoftware.cavedroid.game.mobs; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; -import org.jetbrains.annotations.NotNull; import ru.deadsoftware.cavedroid.misc.Assets; import static ru.deadsoftware.cavedroid.GameScreen.GP; @@ -36,7 +35,7 @@ public class FallingGravel extends Mob { } @Override - public void draw(@NotNull SpriteBatch spriteBatch, float x, float y) { + public void draw(SpriteBatch spriteBatch, float x, float y) { spriteBatch.draw(Assets.gravelSprite, x, y); } diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingSand.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingSand.java index 0f44f05..ee310e4 100644 --- a/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingSand.java +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/FallingSand.java @@ -2,7 +2,6 @@ package ru.deadsoftware.cavedroid.game.mobs; import com.badlogic.gdx.graphics.g2d.SpriteBatch; import com.badlogic.gdx.math.Vector2; -import org.jetbrains.annotations.NotNull; import ru.deadsoftware.cavedroid.misc.Assets; import static ru.deadsoftware.cavedroid.GameScreen.GP; @@ -36,7 +35,7 @@ public class FallingSand extends Mob { } @Override - public void draw(@NotNull SpriteBatch spriteBatch, float x, float y) { + public void draw(SpriteBatch spriteBatch, float x, float y) { spriteBatch.draw(Assets.sandSprite, x, y); } diff --git a/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java new file mode 100644 index 0000000..ed9b92d --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/game/mobs/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.game.mobs; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java new file mode 100644 index 0000000..a12210b --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/game/objects/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.game.objects; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/game/package-info.java b/core/src/ru/deadsoftware/cavedroid/game/package-info.java new file mode 100644 index 0000000..d73a0b6 --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/game/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.game; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java new file mode 100644 index 0000000..f511278 --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/menu/objects/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.menu.objects; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/menu/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/package-info.java new file mode 100644 index 0000000..92cd147 --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/menu/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.menu; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java b/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java new file mode 100644 index 0000000..6a5aa76 --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/menu/submenus/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.menu.submenus; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/misc/package-info.java b/core/src/ru/deadsoftware/cavedroid/misc/package-info.java new file mode 100644 index 0000000..f2c7913 --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/misc/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.misc; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/misc/states/package-info.java b/core/src/ru/deadsoftware/cavedroid/misc/states/package-info.java new file mode 100644 index 0000000..bc647bf --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/misc/states/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid.misc.states; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/core/src/ru/deadsoftware/cavedroid/package-info.java b/core/src/ru/deadsoftware/cavedroid/package-info.java new file mode 100644 index 0000000..9bfa3e8 --- /dev/null +++ b/core/src/ru/deadsoftware/cavedroid/package-info.java @@ -0,0 +1,4 @@ +@ParametersAreNonnullByDefault +package ru.deadsoftware.cavedroid; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file -- 2.29.2