Suppress incorrect warnings and implement some suggestions

This commit is contained in:
Stone_Red
2022-05-19 11:53:45 +02:00
parent 840da9a483
commit c1f7802a33
12 changed files with 14 additions and 12 deletions
@@ -25,9 +25,6 @@ public class YesApplication extends javafx.application.Application {
stage.setTitle("Hello!");
stage.setScene(scene);
//Scale scale = new Scale(0.25,0.25, 0, 0);
//scene.getRoot().getTransforms().add(scale);
stage.setMaximized(true);
stage.show();
}
@@ -5,7 +5,7 @@ import com.yes.yes.utils.Component;
import com.yes.yes.utils.Entity;
public class DestroyBehaviour extends Component {
private String dataKey;
private final String dataKey;
public DestroyBehaviour(Entity entity, BlockContainer blockContainer, String dataKey) {
super(entity, blockContainer);
@@ -8,7 +8,6 @@ import com.yes.yes.world.Chunk;
import javafx.application.Platform;
import javafx.geometry.Pos;
import javafx.scene.layout.StackPane;
import javafx.scene.layout.VBox;
import javafx.scene.paint.Color;
import javafx.scene.shape.Rectangle;
import javafx.scene.transform.Scale;
@@ -59,7 +59,7 @@ public class OfferBehaviour extends Component {
Item item = this.parent.getData(dataKey);
if (item == null) return;
this.receiver.trigger("offerItem", new Pair(parent, item));
this.receiver.trigger("offerItem", new Pair<>(parent, item));
}
@Override
@@ -11,7 +11,6 @@ public class SplitBehaviour extends Component {
private final String[] offerDataKeys;
private int delayCount = 0;
private int offerDataKeyIndex = 0;
private String offerDataKey;
public SplitBehaviour(Entity entity, BlockContainer blockContainer, int delay, String receiveDataKey, String... offerDataKeys) {
super(entity, blockContainer);
@@ -34,7 +33,7 @@ public class SplitBehaviour extends Component {
if (offerDataKeyIndex >= offerDataKeys.length)
offerDataKeyIndex = 0;
offerDataKey = offerDataKeys[offerDataKeyIndex];
String offerDataKey = offerDataKeys[offerDataKeyIndex];
if (parent.getData(offerDataKey) != null) return;
@@ -21,6 +21,7 @@ public class ConveyorBelt extends Entity {
this.getChildren().addAll(t);
}
@SuppressWarnings("unused") // Called dynamically
public ConveyorBelt(BlockContainer blockContainer) {
this();
this.addBehaviour(new PlaceBehaviour(this, blockContainer));
@@ -1,6 +1,8 @@
package com.yes.yes.entities.machines;
import com.yes.yes.behaviours.*;
import com.yes.yes.behaviours.DestroyBehaviour;
import com.yes.yes.behaviours.PlaceBehaviour;
import com.yes.yes.behaviours.ReceiveBehaviour;
import com.yes.yes.utils.BlockContainer;
import com.yes.yes.utils.Direction;
import com.yes.yes.utils.Entity;
@@ -8,7 +10,6 @@ import com.yes.yes.world.Chunk;
import javafx.scene.paint.Color;
import javafx.scene.shape.Circle;
import javafx.scene.shape.Polygon;
import javafx.scene.shape.Rectangle;
public class DestroyMachine extends Entity {
public DestroyMachine() {
@@ -27,6 +28,7 @@ public class DestroyMachine extends Entity {
this.getChildren().addAll(c, t);
}
@SuppressWarnings("unused") // Called dynamically
public DestroyMachine(BlockContainer blockContainer) {
this();
this.addBehaviour(new PlaceBehaviour(this, blockContainer));
@@ -30,6 +30,7 @@ public class GeneratorMachine extends Entity {
this.getChildren().addAll(r, p);
}
@SuppressWarnings("unused") // Called dynamically
public GeneratorMachine(BlockContainer blockContainer) {
this();
this.addBehaviour(new PlaceBehaviour(this, blockContainer));
@@ -17,6 +17,7 @@ public class HubAcceptor extends Entity {
this.getChildren().add(r);
}
@SuppressWarnings("unused") // Called dynamically
public HubAcceptor(BlockContainer blockContainer) {
this();
this.addBehaviour(new PlaceBehaviour(this, blockContainer));
@@ -27,9 +27,10 @@ public class HubDisplay extends Entity {
this.getChildren().addAll(stackPane);
}
@SuppressWarnings("unused") // Called dynamically
public HubDisplay(BlockContainer blockContainer) {
this();
this.addBehaviour(new PlaceBehaviour(this, blockContainer));
this.addBehaviour(new ItemBehaviour(this, blockContainer, "objective"));
this.addBehaviour(new ItemBehaviour(this, blockContainer, "Objective"));
}
}
@@ -28,6 +28,7 @@ public class Splitter extends Entity {
this.getChildren().addAll(p1);
}
@SuppressWarnings("unused") // Called dynamically
public Splitter(BlockContainer blockContainer) {
this();
this.addBehaviour(new PlaceBehaviour(this, blockContainer));
@@ -3,7 +3,7 @@ package com.yes.yes.utils;
import java.util.function.Consumer;
public final class GlobalEventHandler {
private static EventHandler handler = new EventHandler();
private static final EventHandler handler = new EventHandler();
private GlobalEventHandler() {
}