Replace ArrayList type fields with List
This commit is contained in:
parent
32a0f4eaac
commit
72c2a58ef2
@ -310,7 +310,7 @@ public class Settings {
|
|||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public <T> List<Setting<T>> getByValueType(Class<T> klass) {
|
public <T> List<Setting<T>> getByValueType(Class<T> klass) {
|
||||||
ArrayList<Setting<T>> result = new ArrayList<>();
|
List<Setting<T>> result = new ArrayList<>();
|
||||||
for (Setting<?> setting : allSettings) {
|
for (Setting<?> setting : allSettings) {
|
||||||
if (setting.klass.equals(klass)) {
|
if (setting.klass.equals(klass)) {
|
||||||
result.add((Setting<T>) setting);
|
result.add((Setting<T>) setting);
|
||||||
|
@ -235,7 +235,7 @@ public final class CachedRegion implements IBlockTypeAccess {
|
|||||||
short numSpecialBlockTypes = in.readShort();
|
short numSpecialBlockTypes = in.readShort();
|
||||||
for (int i = 0; i < numSpecialBlockTypes; i++) {
|
for (int i = 0; i < numSpecialBlockTypes; i++) {
|
||||||
String blockName = in.readUTF();
|
String blockName = in.readUTF();
|
||||||
ArrayList<BlockPos> locs = new ArrayList<>();
|
List<BlockPos> locs = new ArrayList<>();
|
||||||
location[x][z].put(blockName, locs);
|
location[x][z].put(blockName, locs);
|
||||||
short numLocations = in.readShort();
|
short numLocations = in.readShort();
|
||||||
for (int j = 0; j < numLocations; j++) {
|
for (int j = 0; j < numLocations; j++) {
|
||||||
|
@ -145,7 +145,7 @@ public class MovementDiagonal extends Movement {
|
|||||||
if (toBreakCached != null) {
|
if (toBreakCached != null) {
|
||||||
return toBreakCached;
|
return toBreakCached;
|
||||||
}
|
}
|
||||||
ArrayList<BlockPos> result = new ArrayList<>();
|
List<BlockPos> result = new ArrayList<>();
|
||||||
for (int i = 4; i < 6; i++) {
|
for (int i = 4; i < 6; i++) {
|
||||||
if (!MovementHelper.canWalkThrough(positionsToBreak[i])) {
|
if (!MovementHelper.canWalkThrough(positionsToBreak[i])) {
|
||||||
result.add(positionsToBreak[i]);
|
result.add(positionsToBreak[i]);
|
||||||
|
@ -272,7 +272,7 @@ public class ExampleBaritoneControl extends Behavior {
|
|||||||
}
|
}
|
||||||
if (msg.toLowerCase().equals("costs")) {
|
if (msg.toLowerCase().equals("costs")) {
|
||||||
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
|
Movement[] movements = AStarPathFinder.getConnectedPositions(new BetterBlockPos(playerFeet()), new CalculationContext());
|
||||||
ArrayList<Movement> moves = new ArrayList<>(Arrays.asList(movements));
|
List<Movement> moves = new ArrayList<>(Arrays.asList(movements));
|
||||||
moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext())));
|
moves.sort(Comparator.comparingDouble(movement -> movement.getCost(new CalculationContext())));
|
||||||
for (Movement move : moves) {
|
for (Movement move : moves) {
|
||||||
String[] parts = move.getClass().toString().split("\\.");
|
String[] parts = move.getClass().toString().split("\\.");
|
||||||
|
Loading…
Reference in New Issue
Block a user