本文整理汇总了Java中ic2.api.info.Info类的典型用法代码示例。如果您正苦于以下问题:Java Info类的具体用法?Java Info怎么用?Java Info使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Info类属于ic2.api.info包,在下文中一共展示了Info类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: discharge
import ic2.api.info.Info; //导入依赖的package包/类
public double discharge(double amount, boolean ignoreLimit) {
if(amount <= 0.0D) {
throw new IllegalArgumentException("Amount must be > 0.");
} else {
ItemStack stack = this.getStack();
if(stack == null) {
return 0.0D;
} else {
double realAmount = ElectricItem.manager.discharge(stack, amount, ((TileElectricContainer) this.tile).tier, ignoreLimit, true, false);
if(realAmount <= 0.0D) {
realAmount = Info.itemInfo.getEnergyValue(stack);
if(realAmount <= 0.0D) {
return 0.0D;
}
--stack.stackSize;
if(stack.stackSize <= 0) {
this.putStack(null);
}
}
return realAmount;
}
}
}
示例2: discharge
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Discharge the supplied ItemStack into this sink's energy buffer.
*
* @param stack ItemStack to discharge (null is ignored)
* @param limit Transfer limit, values <= 0 will use the battery's limit
* @return true if energy was transferred
*/
public boolean discharge(ItemStack stack, int limit) {
if (stack == null || !Info.isIc2Available()) {
return false;
}
double amount = capacity - energyStored;
if (amount <= 0) {
return false;
}
if (limit > 0 && limit < amount) {
amount = limit;
}
amount = ElectricItem.manager.discharge(stack, amount, tier, limit > 0, true, false);
energyStored += amount;
return amount > 0;
}
示例3: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loaded, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!parent.getWorld().isRemote &&
Info.isIc2Available()) {
worldObj = parent.getWorld();
pos = parent.getPos();
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例4: onChunkUnload
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link.
* Both invalidate and onChunkUnload have to be used.
*/
@Override
public void onChunkUnload() {
if (addedToEnet &&
Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnet = false;
}
}
示例5: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loading, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!parent.getWorld().isRemote &&
Info.isIc2Available()) {
worldObj = parent.getWorld();
pos = parent.getPos();
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例6: onEntityCollision
import ic2.api.info.Info; //导入依赖的package包/类
@Override
public boolean onEntityCollision(ICropTile crop, Entity entity) {
if (entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).attackEntityFrom(Info.DMG_ELECTRIC, crop.getGain());
return ((EntityLivingBase) entity).isSprinting();
}
return false;
}
示例7: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loaded, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例8: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loading, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例9: updateEntity
import ic2.api.info.Info; //导入依赖的package包/类
public void updateEntity()
{
if ((!addedToEnet) && (!FMLCommonHandler.instance().getEffectiveSide().isClient()) && (Info.isIc2Available()))
{
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例10: onChunkUnload
import ic2.api.info.Info; //导入依赖的package包/类
public void onChunkUnload()
{
if ((addedToEnet) && (Info.isIc2Available()))
{
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnet = false;
}
}
示例11: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loaded, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例12: onChunkUnload
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Forward for the base TileEntity's onChunkUnload(), used for destroying the energy net link.
* Both invalidate and onChunkUnload have to be used.
*/
@Override
public void onChunkUnload() {
if (addedToEnet &&
Info.isIc2Available()) {
MinecraftForge.EVENT_BUS.post(new EnergyTileUnloadEvent(this));
addedToEnet = false;
}
}
示例13: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loading, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}
示例14: charge
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Charge the supplied ItemStack from this source's energy buffer.
*
* @param stack ItemStack to charge (null is ignored)
* @return true if energy was transferred
*/
public boolean charge(ItemStack stack) {
if (stack == null || !Info.isIc2Available()) {
return false;
}
double amount = ElectricItem.manager.charge(stack, energyStored, tier, false, false);
energyStored -= amount;
return amount > 0;
}
示例15: onLoaded
import ic2.api.info.Info; //导入依赖的package包/类
/**
* Notification that the base TileEntity finished loaded, for advanced uses.
* Either updateEntity or onLoaded have to be used.
*/
public void onLoaded() {
if (!addedToEnet &&
!FMLCommonHandler.instance().getEffectiveSide().isClient() &&
Info.isIc2Available()) {
worldObj = parent.getWorldObj();
xCoord = parent.xCoord;
yCoord = parent.yCoord;
zCoord = parent.zCoord;
MinecraftForge.EVENT_BUS.post(new EnergyTileLoadEvent(this));
addedToEnet = true;
}
}