use of net.minecraftforge.event.entity.player.PlayerEvent.Clone in project Bewitchment by Um-Mitternacht.
the class BrewEvents method onPlayerClone.
@SubscribeEvent
public void onPlayerClone(Clone event) {
if (!event.isWasDeath()) {
final EntityPlayer oldPlayer = event.getOriginal();
final EntityPlayer newPlayer = event.getEntityPlayer();
Optional<IBrewStorage> optional = BrewStorageHandler.getBrewStorage(oldPlayer);
optional.ifPresent(oldStorage -> BrewStorageHandler.getBrewStorage(newPlayer).ifPresent(newStorage -> {
newStorage.setBrewMap(oldStorage.getBrewMap());
newStorage.syncToNear(newPlayer);
}));
}
}
Aggregations