Search in sources :

Example 1 with AbstractTileFVMachine

use of team.covertdragon.springfestival.module.fortune.fortunevaluesystem.machines.AbstractTileFVMachine in project SpringFestival by TeamCovertDragon.

the class FortuneValueManager method updatePlayerFortuneValue.

private void updatePlayerFortuneValue(EntityPlayerMP player) {
    IFortuneValueSystem system = player.getCapability(CapabilityLoader.fortuneValue, null);
    if (system != null) {
        // Update player fortune level
        system.addFortune(system.getIncreasingPoint());
        system.setBufPoint(0);
        // Tick FV machines
        for (AbstractTileFVMachine machine : system.getFVMachines()) {
            if (machine.getWorld().getTileEntity(machine.getPos()) == null) {
                TASKS.add(new FortuneManagerActions.ActionDeleteMachine(machine, system));
                continue;
            }
            if (system.shrinkFortune(machine.getRequiredFV())) {
                machine.onFVProvided();
            }
        }
    } else {
        throw new RuntimeException("Unable to read fv system info for player " + player.getGameProfile().getName());
    }
}
Also used : AbstractTileFVMachine(team.covertdragon.springfestival.module.fortune.fortunevaluesystem.machines.AbstractTileFVMachine) IFortuneValueSystem(team.covertdragon.springfestival.module.fortune.fortunevaluesystem.capability.IFortuneValueSystem)

Aggregations

IFortuneValueSystem (team.covertdragon.springfestival.module.fortune.fortunevaluesystem.capability.IFortuneValueSystem)1 AbstractTileFVMachine (team.covertdragon.springfestival.module.fortune.fortunevaluesystem.machines.AbstractTileFVMachine)1