Search in sources :

Example 1 with BeaconBlockEntityAccessor

use of org.spongepowered.common.accessor.world.level.block.entity.BeaconBlockEntityAccessor in project SpongeCommon by SpongePowered.

the class BeaconData method delete.

private static boolean delete(final BeaconBlockEntity holder, final Function<BeaconBlockEntityAccessor, MobEffect> getter, final BiConsumer<BeaconBlockEntityAccessor, MobEffect> setter) {
    final BeaconBlockEntityAccessor accessor = (BeaconBlockEntityAccessor) holder;
    if (accessor.accessor$primaryPower() != null) {
        setter.accept(accessor, null);
        holder.setChanged();
    }
    return true;
}
Also used : BeaconBlockEntityAccessor(org.spongepowered.common.accessor.world.level.block.entity.BeaconBlockEntityAccessor)

Example 2 with BeaconBlockEntityAccessor

use of org.spongepowered.common.accessor.world.level.block.entity.BeaconBlockEntityAccessor in project SpongeCommon by SpongePowered.

the class BeaconData method set.

private static boolean set(final BeaconBlockEntity holder, final PotionEffectType value, final BiConsumer<BeaconBlockEntityAccessor, MobEffect> setter) {
    final BeaconBlockEntityAccessor accessor = (BeaconBlockEntityAccessor) holder;
    final MobEffect effect = (MobEffect) value;
    if (!BeaconBlockEntityAccessor.accessor$VALID_EFFECTS().contains(effect)) {
        return false;
    }
    setter.accept(accessor, (MobEffect) value);
    holder.setChanged();
    return true;
}
Also used : MobEffect(net.minecraft.world.effect.MobEffect) BeaconBlockEntityAccessor(org.spongepowered.common.accessor.world.level.block.entity.BeaconBlockEntityAccessor)

Aggregations

BeaconBlockEntityAccessor (org.spongepowered.common.accessor.world.level.block.entity.BeaconBlockEntityAccessor)2 MobEffect (net.minecraft.world.effect.MobEffect)1