DEADSOFTWARE

Rewrite Block class as Kotlin data class
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / game / objects / Item.java
index 0083001d05d844a3744146e3e0d0cd544d7c89c8..8e664ace9bf0a134783d92e7bca5781eb91ba41d 100644 (file)
@@ -2,20 +2,26 @@ package ru.deadsoftware.cavedroid.game.objects;
 
 import com.badlogic.gdx.graphics.g2d.Sprite;
 
+import javax.annotation.CheckForNull;
+
 public class Item {
 
     private final String name;
     private final String type;
+    @CheckForNull
     private final Sprite tex;
 
-    public Item(String name, String type, Sprite tex) {
+    public Item(String name, String type, @CheckForNull Sprite tex) {
         this.name = name;
         this.type = type;
         this.tex = tex;
-        if (this.tex != null) this.tex.flip(false, true);
+        if (this.tex != null) {
+            this.tex.flip(false, true);
+        }
     }
 
-    public Sprite getTex() {
+    public Sprite getTexture() {
+        assert tex != null;
         return tex;
     }