mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-16 19:05:02 -04:00
Remove 2. Constructor in VersionValueMap
This commit is contained in:
parent
16c5ff8c89
commit
1aecd27657
@ -37,11 +37,11 @@ public class ChangeableIdentifier extends VersionValueMap<String> {
|
||||
}
|
||||
|
||||
public ChangeableIdentifier(IdentifierSet... sets) {
|
||||
super(sets, true);
|
||||
super(sets);
|
||||
}
|
||||
|
||||
public ChangeableIdentifier(String name) {
|
||||
super(name);
|
||||
super(new MapSet<>(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), name));
|
||||
}
|
||||
|
||||
public boolean isValidName(String name, int versionId) {
|
||||
|
@ -13,8 +13,6 @@
|
||||
|
||||
package de.bixilon.minosoft.data;
|
||||
|
||||
import de.bixilon.minosoft.data.mappings.versions.Versions;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
@ -24,14 +22,14 @@ public class VersionValueMap<V> {
|
||||
public VersionValueMap() {
|
||||
}
|
||||
|
||||
public VersionValueMap(MapSet<Integer, V>[] sets, boolean unused) {
|
||||
public VersionValueMap(MapSet<Integer, V>[] sets) {
|
||||
for (MapSet<Integer, V> set : sets) {
|
||||
this.values.put(set.getKey(), set.getValue());
|
||||
}
|
||||
}
|
||||
|
||||
public VersionValueMap(V value) {
|
||||
this.values.put(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), value);
|
||||
public VersionValueMap(MapSet<Integer, V> set) {
|
||||
this.values.put(set.getKey(), set.getValue());
|
||||
}
|
||||
|
||||
public V get(int versionId) {
|
||||
|
@ -19,6 +19,7 @@ import de.bixilon.minosoft.data.VersionValueMap;
|
||||
import de.bixilon.minosoft.data.inventory.Slot;
|
||||
import de.bixilon.minosoft.data.mappings.blocks.Block;
|
||||
import de.bixilon.minosoft.data.mappings.particle.data.ParticleData;
|
||||
import de.bixilon.minosoft.data.mappings.versions.Versions;
|
||||
import de.bixilon.minosoft.data.text.ChatComponent;
|
||||
import de.bixilon.minosoft.data.world.BlockPosition;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
@ -118,14 +119,14 @@ public class EntityMetaData {
|
||||
OPT_VAR_INT(new MapSet[]{new MapSet<>(459, 17)}),
|
||||
POSE(new MapSet[]{new MapSet<>(461, 18)});
|
||||
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
private final VersionValueMap<Integer> valueMap;
|
||||
|
||||
EntityMetaDataValueTypes(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
EntityMetaDataValueTypes(int id) {
|
||||
this.valueMap = new VersionValueMap<>(id);
|
||||
this.valueMap = new VersionValueMap<>(new MapSet<>(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), id));
|
||||
}
|
||||
|
||||
public static EntityMetaDataValueTypes byId(int id, int versionId) {
|
||||
|
@ -40,7 +40,7 @@ data class VillagerData(val type: VillagerTypes, val profession: VillagerProfess
|
||||
ZOMBIE(arrayOf(MapSet(204, -1), MapSet(315, -100)));
|
||||
|
||||
// used earlier (ZombieVillagerMeta)
|
||||
private val valueMap = VersionValueMap(values as Array<out MapSet<Int, Int>>, true)
|
||||
private val valueMap = VersionValueMap(values as Array<out MapSet<Int, Int>>)
|
||||
|
||||
|
||||
fun getId(versionId: Int): Int {
|
||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.data.inventory;
|
||||
|
||||
import de.bixilon.minosoft.data.MapSet;
|
||||
import de.bixilon.minosoft.data.VersionValueMap;
|
||||
import de.bixilon.minosoft.data.mappings.versions.Versions;
|
||||
|
||||
public class InventorySlots {
|
||||
public enum PlayerInventorySlots implements InventoryInterface {
|
||||
@ -94,11 +95,11 @@ public class InventorySlots {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
EntityInventorySlots(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
EntityInventorySlots(int id) {
|
||||
this.valueMap = new VersionValueMap<>(id);
|
||||
this.valueMap = new VersionValueMap<>(new MapSet<>(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), id));
|
||||
}
|
||||
|
||||
public static EntityInventorySlots byId(int id, int versionId) {
|
||||
|
@ -84,7 +84,7 @@ public class PacketBlockEntityMetadata implements ClientboundPacket {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
BlockEntityActions(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
public static BlockEntityActions byId(int id, int versionId) {
|
||||
|
@ -70,7 +70,7 @@ public class PacketChangeGameState implements ClientboundPacket {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
Reason(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
public static Reason byId(int id, int versionId) {
|
||||
|
@ -150,7 +150,7 @@ public class PacketEffect implements ClientboundPacket {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
EffectEffects(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
public static EffectEffects byId(int id, int versionId) {
|
||||
|
@ -57,7 +57,7 @@ public class PacketEntityAnimation implements ClientboundPacket {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
EntityAnimations(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
public static EntityAnimations byId(int id, int versionId) {
|
||||
|
@ -15,6 +15,7 @@ package de.bixilon.minosoft.protocol.packets.clientbound.play;
|
||||
|
||||
import de.bixilon.minosoft.data.MapSet;
|
||||
import de.bixilon.minosoft.data.VersionValueMap;
|
||||
import de.bixilon.minosoft.data.mappings.versions.Versions;
|
||||
import de.bixilon.minosoft.data.text.ChatComponent;
|
||||
import de.bixilon.minosoft.logging.Log;
|
||||
import de.bixilon.minosoft.protocol.packets.ClientboundPacket;
|
||||
@ -93,14 +94,14 @@ public class PacketTitle implements ClientboundPacket {
|
||||
HIDE(new MapSet[]{new MapSet<>(18, 3), new MapSet<>(302, 4)}),
|
||||
RESET(new MapSet[]{new MapSet<>(18, 4), new MapSet<>(302, 5)});
|
||||
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
private final VersionValueMap<Integer> valueMap;
|
||||
|
||||
TitleActions(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
TitleActions(int id) {
|
||||
this.valueMap = new VersionValueMap<>(id);
|
||||
this.valueMap = new VersionValueMap<>(new MapSet<>(Versions.LOWEST_VERSION_SUPPORTED.getVersionId(), id));
|
||||
}
|
||||
|
||||
public static TitleActions byId(int id, int versionId) {
|
||||
|
@ -71,7 +71,7 @@ public class PacketEntityAction implements ServerboundPacket {
|
||||
final VersionValueMap<Integer> valueMap;
|
||||
|
||||
EntityActions(MapSet<Integer, Integer>[] values) {
|
||||
this.valueMap = new VersionValueMap<>(values, true);
|
||||
this.valueMap = new VersionValueMap<>(values);
|
||||
}
|
||||
|
||||
public static EntityActions byId(int id, int versionId) {
|
||||
|
@ -248,7 +248,7 @@ public class InByteBuffer {
|
||||
throw new IllegalArgumentException("Bad nbt");
|
||||
}
|
||||
}
|
||||
TagTypes type = TagTypes.byId(readByte());
|
||||
TagTypes type = TagTypes.byId(readUnsignedByte());
|
||||
if (type == TagTypes.COMPOUND) {
|
||||
// shouldn't be a subtag
|
||||
return new CompoundTag(false, this);
|
||||
|
@ -25,7 +25,7 @@ public final class BitByte {
|
||||
|
||||
public static byte getBitCount(int input) {
|
||||
byte ret = 0;
|
||||
for (byte i = 0; i < Short.BYTES * 8; i++) { // bytes to bits
|
||||
for (byte i = 0; i < Short.SIZE; i++) {
|
||||
if (isBitSet(input, i)) {
|
||||
ret++;
|
||||
}
|
||||
|
@ -20,8 +20,8 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class ListTag extends NBTTag {
|
||||
final TagTypes type;
|
||||
final ArrayList<NBTTag> list;
|
||||
private final TagTypes type;
|
||||
private final ArrayList<NBTTag> list;
|
||||
|
||||
public ListTag(TagTypes type, ArrayList<NBTTag> list) {
|
||||
this.type = type;
|
||||
@ -30,7 +30,7 @@ public class ListTag extends NBTTag {
|
||||
|
||||
public ListTag(TagTypes type, NBTTag[] list) {
|
||||
this.type = type;
|
||||
this.list = (ArrayList<NBTTag>) Arrays.asList(list);
|
||||
this.list = new ArrayList<>(Arrays.asList(list));
|
||||
}
|
||||
|
||||
public ListTag(InByteBuffer buffer) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user