use of am2.api.power.PowerTypes in project ArsMagica2 by Mithion.
the class TileEntityManaBattery method updateEntity.
@Override
public void updateEntity() {
if (worldObj.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord)) {
this.setPowerRequests();
} else {
this.setNoPowerRequests();
}
if (this.outputPowerType == PowerTypes.NONE && !this.worldObj.isRemote) {
PowerTypes highest = PowerNodeRegistry.For(worldObj).getHighestPowerType(this);
float amt = PowerNodeRegistry.For(worldObj).getPower(this, highest);
if (amt > 0) {
this.outputPowerType = highest;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
tickCounter++;
if (tickCounter % 600 == 0) {
worldObj.notifyBlockChange(xCoord, yCoord, zCoord, BlocksCommonProxy.manaBattery);
tickCounter = 0;
}
super.updateEntity();
}
use of am2.api.power.PowerTypes in project ArsMagica2 by Mithion.
the class ItemSpellStaff method onItemUseFirst.
@Override
public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
if (isMagiTechStaff()) {
if (!world.isRemote) {
TileEntity te = world.getTileEntity(x, y, z);
if (te != null && te instanceof IPowerNode) {
if (player.isSneaking()) {
AMNetHandler.INSTANCE.syncPowerPaths((IPowerNode) te, (EntityPlayerMP) player);
} else {
PowerTypes[] types = ((IPowerNode) te).getValidPowerTypes();
for (PowerTypes type : types) {
float power = PowerNodeRegistry.For(world).getPower((IPowerNode) te, type);
player.addChatMessage(new ChatComponentText(String.format(StatCollector.translateToLocal("am2.tooltip.det_eth"), type.chatColor(), type.name(), String.format("%.2f", power))));
}
}
return true;
}
}
}
return false;
}
Aggregations