fix npe, remove living bed position

This commit is contained in:
creeper123123321 2019-03-04 10:33:20 -03:00
parent 8e2feeb375
commit 3252d48383
No known key found for this signature in database
GPG Key ID: 0AC57D54786721D1
2 changed files with 9 additions and 1 deletions

View File

@ -523,6 +523,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
@Override
public Item handleItemToClient(Item i) {
Item item = super.handleItemToClient(i);
if (item == null) return null;
item.setIdentifier(getOldItemId(item.getIdentifier()));
CompoundTag tag;
@ -556,6 +557,7 @@ public class BlockItemPackets1_14 extends BlockItemRewriter<Protocol1_13_2To1_14
@Override
public Item handleItemToServer(Item i) {
Item item = super.handleItemToServer(i);
if (item == null) return null;
item.setIdentifier(getNewItemId(item.getIdentifier()));
CompoundTag tag;

View File

@ -126,7 +126,7 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
Optional<Integer> oldId = EntityTypeMapping.getOldId(type);
if (!oldId.isPresent()) {
if (!hasData(entityType))
ViaBackwards.getPlatform().getLogger().warning("Could not find 1.12 entity type for 1.13 entity type " + type + "/" + entityType);
ViaBackwards.getPlatform().getLogger().warning("Could not find 1.13.2 entity type for 1.14 entity type " + type + "/" + entityType);
} else {
wrapper.set(Type.VAR_INT, 1, oldId.get());
}
@ -283,6 +283,12 @@ public class EntityPackets1_14 extends EntityRewriter<Protocol1_13_2To1_14> {
if (e.getIndex() > 6) e.getData().setId(e.getIndex() - 1);
return e.getData();
});
// Remove bed location - todo send sleep packet
registerMetaHandler().filter(EntityType1_14.EntityType.LIVINGENTITY, true, 12).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.LIVINGENTITY, true).handle(e -> {
if (e.getIndex() > 12) e.getData().setId(e.getIndex() - 1);
return e.getData();
});
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 13).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 14).removed();
registerMetaHandler().filter(EntityType1_14.EntityType.CAT, 15).removed();