Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-12-26 16:12:42 +01:00
18w16a
Dieser Commit ist enthalten in:
Ursprung
1e0113a58a
Commit
e41f445e92
@ -1,5 +1,6 @@
|
||||
package us.myles.ViaVersion.protocols.protocolsnapshotto1_12_2.data;
|
||||
|
||||
import com.google.common.base.Optional;
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
|
||||
@ -67,4 +68,9 @@ public class SpawnEggRewriter {
|
||||
return 25100288;
|
||||
return (383 << 16 | (spawnEggs.get(entityIdentifier) & 0xFFFF));
|
||||
}
|
||||
|
||||
public static Optional<String> getEntityId(int spawnEggId) {
|
||||
if (spawnEggId >> 16 != 383) return Optional.absent();
|
||||
return Optional.fromNullable(spawnEggs.inverse().get(spawnEggId & 0xFFFF));
|
||||
}
|
||||
}
|
||||
|
@ -250,8 +250,8 @@ public class InventoryPackets {
|
||||
}
|
||||
|
||||
if (!MappingData.oldToNewItems.containsKey(rawId)) {
|
||||
if (MappingData.oldToNewItems.containsKey(item.getId() << 4)) {
|
||||
rawId = item.getId() << 4;
|
||||
if (MappingData.oldToNewItems.containsKey(rawId & ~0xF)) {
|
||||
rawId &= ~0xF; // Remove data
|
||||
} else {
|
||||
System.out.println("FAILED TO GET 1.13 ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
|
||||
rawId = 16; // Stone
|
||||
@ -286,13 +286,30 @@ public class InventoryPackets {
|
||||
for (Map.Entry<Integer, Integer> entry : MappingData.oldToNewItems.entrySet()) {
|
||||
if (entry.getValue() == item.getId()) {
|
||||
int oldId = entry.getKey();
|
||||
// Handle spawn eggs
|
||||
Optional<String> eggEntityId = SpawnEggRewriter.getEntityId(oldId);
|
||||
if (eggEntityId.isPresent()) {
|
||||
rawId = 383 << 16;
|
||||
if (tag == null)
|
||||
item.setTag(tag = new CompoundTag("tag"));
|
||||
if (!tag.contains("EntityTag")) {
|
||||
CompoundTag entityTag = new CompoundTag("EntityTag");
|
||||
entityTag.put(new StringTag("id", eggEntityId.get()));
|
||||
tag.put(entityTag);
|
||||
}
|
||||
} else {
|
||||
rawId = (oldId >> 4) << 16 | oldId & 0xF;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (rawId != null) {
|
||||
if (rawId == null) {
|
||||
System.out.println("FAILED TO GET 1.12 ITEM FOR " + item.getId());
|
||||
rawId = 0x10000; // Stone
|
||||
}
|
||||
|
||||
item.setId((short) (rawId >> 16));
|
||||
item.setData((short) (rawId & 0xFFFF));
|
||||
|
||||
@ -323,9 +340,6 @@ public class InventoryPackets {
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
System.out.println("FAILED TO GET 1.12 ITEM FOR " + item.getId()); // TODO: Make this nicer etc, perhaps fix issues with mapping :T
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDamageable(int id) {
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren