本文整理汇总了Java中forestry.api.genetics.IEffectData类的典型用法代码示例。如果您正苦于以下问题:Java IEffectData类的具体用法?Java IEffectData怎么用?Java IEffectData使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IEffectData类属于forestry.api.genetics包,在下文中一共展示了IEffectData类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doEffectThrottled
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
List<EntityLivingBase> entityList = this.getEntitiesWithinRange(genome, housing, EntityLivingBase.class);
for (EntityLivingBase e : entityList) {
if (this.isMalicious) {
int armorPieces = BeeManager.armorApiaristHelper.wearsItems(e, getUID(), true);
int finalDuration = this.duration / 4 * (4 - armorPieces);
if (finalDuration > 0) {
e.addPotionEffect(new PotionEffect(this.potionId, finalDuration, 0));
}
} else {
if (e instanceof EntityPlayer) {
e.addPotionEffect(new PotionEffect(this.potionId, this.duration, 0));
}
}
}
storedData.setInteger(0, 0);
return storedData;
}
示例2: doEffectThrottled
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
// Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
transmutationController.attemptTransmutations(world, biome,
new ItemStack(world.getBlock(xCoord, yCoord, zCoord), 1, world.getBlockMetadata(xCoord, yCoord, zCoord)), xCoord, yCoord, zCoord);
storedData.setInteger(0, 0);
return storedData;
}
示例3: doEffect
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (isThrottled(storedData))
return storedData;
AxisAlignedBB beatifyBox = getBounding(genome, housing, 1.0f);
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, beatifyBox);
for (Object obj : list) {
EntityPlayer player = (EntityPlayer) obj;
player.addPotionEffect(new PotionEffect(potionId, duration, 0));
}
return storedData;
}
示例4: doEffect
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (isThrottled(storedData))
return storedData;
AxisAlignedBB hurtBox = getBounding(genome, housing, 1.0f);
List list = housing.getWorld().getEntitiesWithinAABB(EntityMob.class, hurtBox);
for (Object obj : list) {
EntityMob mob = (EntityMob) obj;
mob.attackEntityFrom(DamageSource.generic, 2);
}
return storedData;
}
示例5: doEffect
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData[] doEffect(IEffectData[] storedData, IBeeHousing housing) {
IAlleleBeeEffect effect = genome.getEffect();
if (effect == null)
return null;
storedData[0] = doEffect(effect, storedData[0], housing);
// Return here if the primary can already not be combined
if (!effect.isCombinable())
return storedData;
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal());
if (!secondary.isCombinable())
return storedData;
storedData[1] = doEffect(secondary, storedData[1], housing);
return storedData;
}
示例6: doFX
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData[] doFX(IEffectData[] storedData, IBeeHousing housing) {
IAlleleBeeEffect effect = genome.getEffect();
if (effect == null)
return null;
storedData[0] = doFX(effect, storedData[0], housing);
// Return here if the primary can already not be combined
if (!effect.isCombinable())
return storedData;
IAlleleBeeEffect secondary = (IAlleleBeeEffect) genome.getInactiveAllele(EnumBeeChromosome.EFFECT.ordinal());
if (!secondary.isCombinable())
return storedData;
storedData[1] = doFX(secondary, storedData[1], housing);
return storedData;
}
示例7: doEffect
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (isThrottled(storedData))
return storedData;
AxisAlignedBB beatifyBox = getBounding(genome, housing, 1.0f);
List list = housing.getWorld().getEntitiesWithinAABB(EntityPlayer.class, beatifyBox);
for (Object obj : list) {
EntityPlayer player = (EntityPlayer) obj;
player.addExperience(2);
}
return storedData;
}
示例8: doFX
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doFX(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
int[] area = genome.getTerritory();
area[0] *= housing.getTerritoryModifier(genome);
area[1] *= housing.getTerritoryModifier(genome);
area[2] *= housing.getTerritoryModifier(genome);
if (area[0] < 1) {
area[0] = 1;
}
if (area[1] < 1) {
area[1] = 1;
}
if (area[2] < 1) {
area[2] = 1;
}
PluginForestryApiculture.proxy.addBeeHiveFX(Defaults.TEXTURE_PARTICLES_BEE, housing.getWorld(), housing.getXCoord(), housing.getYCoord(),
housing.getZCoord(), genome.getPrimaryAsBee().getPrimaryColor(), area[0], area[1], area[2]);
return storedData;
}
示例9: validateStorage
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
示例10: validateStorage
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new magicbees.bees.allele.effect.EffectData(1, 0, 0);
}
return storedData;
}
示例11: validateStorage
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
storedData = new EffectData(1, 0, 0);
}
return storedData;
}
示例12: doEffectThrottled
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
if (this.spawnMob(genome, housing)) {
storedData.setInteger(0, 0);
}
return storedData;
}
示例13: doEffectThrottled
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
protected IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorld();
ChunkCoordinates coords = housing.getCoordinates();
IBeeModifier beeModifier = BeeManager.beeRoot.createBeeHousingModifier(housing);
// Get random coords within territory
int xRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[0]);
int yRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[1]);
int zRange = (int) (beeModifier.getTerritoryModifier(genome, 1f) * genome.getTerritory()[2]);
int xCoord = coords.posX + world.rand.nextInt(xRange) - xRange / 2;
int yCoord = coords.posY + world.rand.nextInt(yRange) - yRange / 2;
int zCoord = coords.posZ + world.rand.nextInt(zRange) - zRange / 2;
Block block = world.getBlock(xCoord, yCoord, zCoord);
if (block != null) {
ItemStack source = new ItemStack(block, 1, world.getBlockMetadata(xCoord, yCoord, zCoord));
for (ItemStack key : crumbleMap.keySet()) {
if (OreDictionary.itemMatches(source, key, false)) {
ItemStack target = crumbleMap.get(key);
world.setBlock(xCoord, yCoord, zCoord, Block.getBlockFromItem(target.getItem()), target.getItemDamage(), 2);
break;
}
}
}
storedData.setInteger(0, 0);
return storedData;
}
示例14: validateStorage
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData validateStorage(IEffectData storedData) {
if (storedData == null || !(storedData instanceof magicbees.bees.allele.effect.EffectData)) {
// Throttle; Ready to spawn
storedData = new EffectData(1, 1, 0);
}
return storedData;
}
示例15: doEffectThrottled
import forestry.api.genetics.IEffectData; //导入依赖的package包/类
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
// Check if we're ready to spawn the mob.
boolean didSpawn = false;
if (storedData.getBoolean(0)) {
World w = housing.getWorld();
int roll = w.rand.nextInt(100);
if (roll <= chanceToSpawn) {
if (spawnsWhilePlayerNear) {
EntityPlayer target = findPlayerTarget(genome, housing);
// Let's spawn a mob. =D
if (target != null) {
didSpawn = spawnMob(genome, target, w, housing, false);
} else if (alternateMob != null) {
didSpawn = spawnMob(genome, null, w, housing, true);
}
} else {
storedData.setBoolean(0, !this.spawnMob(genome, null, w, housing, true));
}
} else {
playMobLiveSound(genome, housing, w);
didSpawn = true;
}
if (didSpawn) {
storedData.setBoolean(0, !didSpawn);
storedData.setInteger(0, storedData.getInteger(0) - throttle);
}
}
else {
storedData.setBoolean(0, true);
}
return storedData;
}