use of net.minecraft.tileentity.TileEntityBeacon in project SpongeCommon by SpongePowered.
the class SpongeBeaconBuilder method buildContent.
@Override
protected Optional<Beacon> buildContent(DataView container) throws InvalidDataException {
return super.buildContent(container).flatMap(beacon -> {
if (!container.contains(DataQueries.PRIMARY) || !container.contains(DataQueries.SECONDARY)) {
return Optional.empty();
}
final BeaconData beaconData = new SpongeBeaconData();
beaconData.set(Keys.BEACON_PRIMARY_EFFECT, Optional.of((PotionEffectType) Potion.getPotionById(container.getInt(DataQueries.PRIMARY).get())));
beaconData.set(Keys.BEACON_SECONDARY_EFFECT, Optional.of((PotionEffectType) Potion.getPotionById(container.getInt(DataQueries.SECONDARY).get())));
beacon.offer(beaconData);
((TileEntityBeacon) beacon).validate();
return Optional.of(beacon);
});
}
use of net.minecraft.tileentity.TileEntityBeacon in project BloodMagic by WayofTime.
the class RitualEffectOmegaStalling method performEffect.
@Override
public void performEffect(IMasterRitualStone ritualStone) {
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (world.getWorldTime() % 20 != 0) {
return;
}
TileEntity tile = world.getTileEntity(x, y + 5, z);
if (tile instanceof TileEntityBeacon) {
int levels = ((TileEntityBeacon) tile).getLevels();
if (levels >= 4) {
int horizontalRadius = 100;
int verticalRadius = 100;
List<EntityPlayer> playerList = SpellHelper.getPlayersInRange(world, x + 0.5, y + 0.5, z + 0.5, horizontalRadius, verticalRadius);
for (EntityPlayer player : playerList) {
if (SoulNetworkHandler.canSyphonFromOnlyNetwork(owner, getCostPerRefresh())) {
Reagent reagent = APISpellHelper.getPlayerReagentType(player);
OmegaParadigm parad = OmegaRegistry.getParadigmForReagent(reagent);
if (parad != null) {
float costOffset = parad.getCostPerTickOfUse(player);
parad.setOmegaStalling(player, 100);
SoulNetworkHandler.syphonFromNetwork(owner, (int) (getCostPerRefresh() * Math.min(costOffset, 1)));
}
}
}
}
}
}
Aggregations