mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-09 07:20:04 -04:00
update todo, add all items
This commit is contained in:
parent
ffbff15ca8
commit
56a8d5c3f1
@ -13,11 +13,13 @@
|
||||
|
||||
package de.bixilon.minosoft.game.datatypes;
|
||||
|
||||
import de.bixilon.minosoft.game.datatypes.entities.Items;
|
||||
import de.bixilon.minosoft.nbt.tag.CompoundTag;
|
||||
|
||||
public class Slot {
|
||||
int itemId;
|
||||
int itemCount;
|
||||
short itemMetadata;
|
||||
CompoundTag nbt;
|
||||
|
||||
public Slot(int itemId, int itemCount, CompoundTag nbt) {
|
||||
@ -26,8 +28,9 @@ public class Slot {
|
||||
this.nbt = nbt;
|
||||
}
|
||||
|
||||
public Slot(short itemId, byte itemCount, short itemDamage, CompoundTag nbt) {
|
||||
public Slot(short itemId, byte itemCount, short itemMetadata, CompoundTag nbt) {
|
||||
this.itemId = itemId;
|
||||
this.itemMetadata = itemMetadata;
|
||||
this.itemCount = itemCount;
|
||||
this.nbt = nbt;
|
||||
}
|
||||
@ -40,14 +43,19 @@ public class Slot {
|
||||
return itemCount;
|
||||
}
|
||||
|
||||
public short getItemMetadata() {
|
||||
return itemMetadata;
|
||||
}
|
||||
|
||||
public CompoundTag getNbt() {
|
||||
return nbt;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
String itemName = Items.byLegacy(getItemId(), getItemMetadata()).name();
|
||||
if (nbt != null && nbt.containsKey("display") && nbt.getCompoundTag("display").containsKey("Name")) { // check if object has nbt data, and a custom display name
|
||||
return new TextComponent(nbt.getCompoundTag("display").getStringTag("Name").getValue()).getColoredMessage();
|
||||
return String.format("%s (%s)", new TextComponent(nbt.getCompoundTag("display").getStringTag("Name").getValue()).getColoredMessage(), itemName);
|
||||
}
|
||||
return "<ToDo>"; //ToDo display name per Item
|
||||
return itemName; //ToDo display name per Item
|
||||
}
|
||||
}
|
||||
|
1040
src/main/java/de/bixilon/minosoft/game/datatypes/entities/Items.java
Normal file
1040
src/main/java/de/bixilon/minosoft/game/datatypes/entities/Items.java
Normal file
File diff suppressed because it is too large
Load Diff
@ -24,7 +24,6 @@ public class AgeableMetaData extends MobMetaData {
|
||||
|
||||
|
||||
public int getAge() {
|
||||
//ToDo custom Potion Effect Color Type
|
||||
switch (version) {
|
||||
case VERSION_1_7_10:
|
||||
return (int) sets.get(12).getData();
|
||||
|
@ -32,7 +32,7 @@ public class PacketEncryptionKeyRequest implements ClientboundPacket {
|
||||
publicKey = buffer.readBytes(buffer.readShort()); // read length, then the bytes
|
||||
verifyToken = buffer.readBytes(buffer.readShort()); // read length, then the bytes
|
||||
break;
|
||||
} // ToDo
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -41,7 +41,7 @@ public class PacketEntityEquipment implements ClientboundPacket {
|
||||
@Override
|
||||
public void log() {
|
||||
if (data != null) {
|
||||
Log.protocol(String.format("Entity equipment changed (entityId=%d, slot=%s): %s", entityId, slot.name(), data.getDisplayName()));
|
||||
Log.protocol(String.format("Entity equipment changed (entityId=%d, slot=%s): %dx %s", entityId, slot.name(), data.getItemCount(), data.getDisplayName()));
|
||||
} else {
|
||||
// null means nothing, means air
|
||||
Log.protocol(String.format("Entity equipment changed (entityId=%d, slot=%s): AIR", entityId, slot.name()));
|
||||
|
@ -29,7 +29,7 @@ public class PacketEntityHeadRotation implements ClientboundPacket {
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
this.entityId = buffer.readInteger();
|
||||
this.headYaw = buffer.readByte(); //ToDo
|
||||
this.headYaw = buffer.readByte();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class PacketEntityPositionAndRotation implements ClientboundPacket {
|
||||
case VERSION_1_7_10:
|
||||
this.entityId = buffer.readInteger();
|
||||
this.location = new RelativeLocation(buffer.readFixedPointNumberByte(), buffer.readFixedPointNumberByte(), buffer.readFixedPointNumberByte());
|
||||
this.yaw = buffer.readByte(); //ToDo
|
||||
this.yaw = buffer.readByte(); //ToDo dividing, ...
|
||||
this.pitch = buffer.readByte();
|
||||
break;
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class PacketEntityRotation implements ClientboundPacket {
|
||||
switch (v) {
|
||||
case VERSION_1_7_10:
|
||||
this.entityId = buffer.readInteger();
|
||||
this.yaw = buffer.readByte(); //ToDo
|
||||
this.yaw = buffer.readByte();
|
||||
this.pitch = buffer.readByte();
|
||||
break;
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class PacketEntityTeleport implements ClientboundPacket {
|
||||
case VERSION_1_7_10:
|
||||
this.entityId = buffer.readInteger();
|
||||
this.location = new Location(buffer.readFixedPointNumberInteger(), buffer.readFixedPointNumberInteger(), buffer.readFixedPointNumberInteger());
|
||||
this.yaw = buffer.readByte(); //ToDo
|
||||
this.yaw = buffer.readByte();
|
||||
this.pitch = buffer.readByte();
|
||||
break;
|
||||
}
|
||||
|
@ -36,7 +36,7 @@ public class PacketSpawnMob implements ClientboundPacket {
|
||||
int entityId = buffer.readVarInt();
|
||||
Mobs type = Mobs.byType(buffer.readByte());
|
||||
Location location = new Location(buffer.readFixedPointNumberInteger(), buffer.readFixedPointNumberInteger(), buffer.readFixedPointNumberInteger());
|
||||
int yaw = buffer.readByte(); //ToDo
|
||||
int yaw = buffer.readByte();
|
||||
int pitch = buffer.readByte();
|
||||
int headPitch = buffer.readByte();
|
||||
Velocity velocity = new Velocity(buffer.readShort(), buffer.readShort(), buffer.readShort());
|
||||
|
@ -112,7 +112,6 @@ public class InByteBuffer {
|
||||
public String readString() {
|
||||
int length = readVarInt();
|
||||
if (length > ProtocolDefinition.STRING_MAX_LEN) {
|
||||
// ToDo throw new PacketDataException(String.format("String is longer than %s", ProtocolDefinition.STRING_MAX_LEN));
|
||||
return null;
|
||||
}
|
||||
return new String(readBytes(length), StandardCharsets.UTF_8);
|
||||
|
@ -89,7 +89,6 @@ public class OutByteBuffer {
|
||||
|
||||
public void writeString(String s) {
|
||||
if (s.length() > ProtocolDefinition.STRING_MAX_LEN) {
|
||||
//ToDo
|
||||
writeByte((byte) 0); // write length 0
|
||||
}
|
||||
writeVarInt(s.length());
|
||||
|
Loading…
x
Reference in New Issue
Block a user