Add getSpawnParticleHandler method to ItemRewriter

This commit is contained in:
KennyTV 2020-12-09 11:03:40 +01:00
parent 52b95eab28
commit a4d1ac3b95
No known key found for this signature in database
GPG Key ID: 6BE3B555EBC5982B
2 changed files with 22 additions and 18 deletions

View File

@ -205,7 +205,13 @@ public class ItemRewriter {
map(Type.FLOAT); // 7 - Offset Z
map(Type.FLOAT); // 8 - Particle Data
map(Type.INT); // 9 - Particle Count
handler(wrapper -> {
handler(getSpawnParticleHandler(itemType, coordType));
}
});
}
public PacketHandler getSpawnParticleHandler(Type<Item> itemType, Type<?> coordType) {
return wrapper -> {
int id = wrapper.get(Type.INT, 0);
if (id == -1) return;
@ -221,9 +227,7 @@ public class ItemRewriter {
if (newId != id) {
wrapper.set(Type.INT, 0, newId);
}
});
}
});
};
}
// Only sent to the client

View File

@ -43,8 +43,8 @@ public class EntityPackets {
dimensionName = "minecraft:overworld";
}
wrapper.write(Type.STRING, dimensionName); // dimension type
wrapper.write(Type.STRING, dimensionName); // dimension
wrapper.write(Type.STRING, dimensionName); // world
};
public static final CompoundTag DIMENSIONS_TAG = new CompoundTag("");
private static final String[] WORLD_NAMES = {"minecraft:overworld", "minecraft:the_nether", "minecraft:the_end"};