当前位置: 首页>>代码示例>>Java>>正文


Java IEffectData.setInteger方法代码示例

本文整理汇总了Java中forestry.api.genetics.IEffectData.setInteger方法的典型用法代码示例。如果您正苦于以下问题:Java IEffectData.setInteger方法的具体用法?Java IEffectData.setInteger怎么用?Java IEffectData.setInteger使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在forestry.api.genetics.IEffectData的用法示例。


在下文中一共展示了IEffectData.setInteger方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:22,代码来源:AlleleEffectPotion.java

示例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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:24,代码来源:AlleleEffectTransmuting.java

示例3: 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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:9,代码来源:AlleleEffectSpawnMobWeighted.java

示例4: 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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:33,代码来源:AlleleEffectCrumbling.java

示例5: 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;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:39,代码来源:AlleleEffectSpawnMob.java

示例6: doEffectThrottled

import forestry.api.genetics.IEffectData; //导入方法依赖的package包/类
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
	List<EntityPlayer> entityList = this.getEntitiesWithinRange(genome, housing, EntityPlayer.class);

	for (EntityPlayer player : entityList) {
		player.curePotionEffects(new ItemStack(Items.milk_bucket));
	}
	storedData.setInteger(0, 0);

	return storedData;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:12,代码来源:AlleleEffectCure.java

示例7: 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);
	int range = Math.max((int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f)), 1);
	List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
	
       if (NodeHelper.growNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
       	storedData.setInteger(0, storedData.getInteger(0) - throttle);
       }

	return storedData;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:15,代码来源:AlleleEffectEmpowering.java

示例8: 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);
	int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
	List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
	
    if (NodeHelper.repairNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
    	storedData.setInteger(0, storedData.getInteger(0) - throttle);
    }
   
	return storedData;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:15,代码来源:AlleleEffectNodeRepair.java

示例9: 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);
	int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
	List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
	
       if (NodeHelper.rechargeNodeInRange(chunks, world, coords.posX, coords.posY, coords.posZ, range)) {
       	storedData.setInteger(0, storedData.getInteger(0) - throttle);
       }

	return storedData;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:15,代码来源:AlleleEffectRecharge.java

示例10: 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);
	int range = (int)Math.ceil(genome.getTerritory()[0] * beeModifier.getTerritoryModifier(genome, 1f));
	List<Chunk> chunks = BlockUtil.getChunksInSearchRange(world, coords.posX, coords.posZ, range);
	
    if (NodeHelper.convertNodeInRangeToType(chunks, world, coords.posX, coords.posY, coords.posZ, range, targetType)) {
    	storedData.setInteger(0, storedData.getInteger(0) - throttle);
    }
   
	return storedData;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:15,代码来源:AlleleEffectNodeConversion.java

示例11: doEffect

import forestry.api.genetics.IEffectData; //导入方法依赖的package包/类
@Override
public final IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing)
{
	int count = storedData.getInteger(0);
	if (count >= this.throttle)
	{
		storedData = this.doEffectThrottled(genome, storedData, housing);
	}
	else
	{
		storedData.setInteger(0, count + 1);
	}
	return storedData;
}
 
开发者ID:MagicBees,项目名称:MagicBees,代码行数:15,代码来源:AlleleEffect.java

示例12: isThrottled

import forestry.api.genetics.IEffectData; //导入方法依赖的package包/类
public boolean isThrottled(IEffectData storedData) {

		int throttle = storedData.getInteger(0);
		throttle++;
		storedData.setInteger(0, throttle);

		if (throttle < getThrottle())
			return true;

		// Reset since we are done throttling.
		storedData.setInteger(0, 0);
		return false;
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:14,代码来源:AlleleEffectThrottled.java

示例13: progressExplosion

import forestry.api.genetics.IEffectData; //导入方法依赖的package包/类
private void progressExplosion(IEffectData storedData, World world, int x, int y, int z) {

		int explosionTimer = storedData.getInteger(indexExplosionTimer);
		explosionTimer--;
		storedData.setInteger(indexExplosionTimer, explosionTimer);

		if (explosionTimer > 0)
			return;

		world.createExplosion(null, x, y, z, storedData.getInteger(indexExplosionForce), false);
	}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:12,代码来源:AlleleEffectCreeper.java

示例14: doEffect

import forestry.api.genetics.IEffectData; //导入方法依赖的package包/类
@Override
public IEffectData doEffect(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {

	World world = housing.getWorld();

	if (isThrottled(storedData))
		return storedData;

	// If we are already triggered, we continue the explosion sequence.
	if (storedData.getInteger(indexExplosionTimer) > 0) {
		progressExplosion(storedData, world, housing.getXCoord(), housing.getYCoord(), housing.getZCoord());
		return storedData;
	}

	AxisAlignedBB infectionBox = getBounding(genome, housing, 1.0f);

	List list = world.getEntitiesWithinAABB(EntityPlayer.class, infectionBox);

	for (Object obj : list) {

		EntityPlayer player = (EntityPlayer) obj;

		int chance = explosionChance;
		storedData.setInteger(indexExplosionForce, defaultForce);

		// Players are not attacked if they wear a full set of apiarist's
		// armor.
		int count = ItemArmorApiarist.wearsItems(player);
		// Full set, no damage/effect
		if (count > 3) {
			continue;
		} else if (count > 2) {
			chance = 5;
			storedData.setInteger(indexExplosionForce, 6);
		} else if (count > 1) {
			chance = 20;
			storedData.setInteger(indexExplosionForce, 8);
		} else if (count > 0) {
			chance = 35;
			storedData.setInteger(indexExplosionForce, 10);
		}

		if (world.rand.nextInt(1000) >= chance) {
			continue;
		}

		world.playSoundEffect(housing.getXCoord(), housing.getYCoord(), housing.getZCoord(), "mob.creeper", 4F,
				(1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
		storedData.setInteger(indexExplosionTimer, 2); // Set explosion
														// timer
	}

	return storedData;
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:55,代码来源:AlleleEffectCreeper.java


注:本文中的forestry.api.genetics.IEffectData.setInteger方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。