3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-09-08 13:52:50 +02:00

Remove some more unncessary/doubled map check

Dieser Commit ist enthalten in:
KennyTV 2018-09-30 21:19:18 +02:00
Ursprung 449ec15309
Commit 033d3bcd4d
7 geänderte Dateien mit 11 neuen und 25 gelöschten Zeilen

Datei anzeigen

@ -33,9 +33,7 @@ public class EntityTracker extends StoredObject {
}
public Optional<Entity1_11Types.EntityType> get(int id) {
if (!has(id))
return Optional.absent();
return Optional.of(clientEntityTypes.get(id));
return Optional.fromNullable(clientEntityTypes.get(id));
}
public void addHologram(int entId) {

Datei anzeigen

@ -28,9 +28,7 @@ public class EntityTracker extends StoredObject {
}
public Optional<Entity1_12Types.EntityType> get(int id) {
if (!has(id))
return Optional.absent();
return Optional.of(clientEntityTypes.get(id));
return Optional.fromNullable(clientEntityTypes.get(id));
}
}

Datei anzeigen

@ -46,12 +46,6 @@ public class PaintingProvider implements Provider {
// Handle older versions
if (!motive.startsWith("minecraft:"))
motive = "minecraft:" + motive.toLowerCase();
Integer index = paintings.get(motive);
if (index != null) {
return Optional.of(index);
}
return Optional.absent();
return Optional.fromNullable(paintings.get(motive));
}
}

Datei anzeigen

@ -28,9 +28,7 @@ public class EntityTracker extends StoredObject {
}
public Optional<Entity1_13Types.EntityType> get(int id) {
if (!has(id))
return Optional.absent();
return Optional.of(clientEntityTypes.get(id));
return Optional.fromNullable(clientEntityTypes.get(id));
}
}

Datei anzeigen

@ -173,12 +173,7 @@ public enum MetaIndex {
private static Optional<MetaIndex> getIndex(Entity1_10Types.EntityType type, int index) {
Pair pair = new Pair<>(type, index);
MetaIndex metaIndex = metadataRewrites.get(pair);
if (metaIndex != null) {
return Optional.of(metaIndex);
}
return Optional.absent();
return Optional.fromNullable(metadataRewrites.get(pair));
}
public static MetaIndex searchIndex(Entity1_10Types.EntityType type, int index) {

Datei anzeigen

@ -57,11 +57,14 @@ public class CommandBlockStorage extends StoredObject {
if (blocks == null)
return Optional.absent();
CompoundTag tag = blocks.get(position).clone();
CompoundTag tag = blocks.get(position);
if (tag == null)
return Optional.absent();
tag = tag.clone();
tag.put(new ByteTag("powered", (byte) 0));
tag.put(new ByteTag("auto", (byte) 0));
tag.put(new ByteTag("conditionMet", (byte) 0));
return Optional.of(tag);
}

Datei anzeigen

@ -183,7 +183,7 @@ public abstract class Config implements ConfigurationProvider {
public List<Integer> getIntegerList(String key) {
Object o = this.config.get(key);
if (o != null) {
return (List<Integer>) this.config.get(key);
return (List<Integer>) o;
} else {
return new ArrayList<>();
}