本文整理汇总了Java中thaumcraft.common.lib.utils.Utils类的典型用法代码示例。如果您正苦于以下问题:Java Utils类的具体用法?Java Utils怎么用?Java Utils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Utils类属于thaumcraft.common.lib.utils包,在下文中一共展示了Utils类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: taintplosion
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
public static void taintplosion(World world, int x, int y, int z, boolean taintBiome, int chanceToTaint, float str, int size, int blocksAffected) {
if(chanceToTaint < 1) chanceToTaint = 1;
world.createExplosion(null, x + 0.5D, y + 0.5D, z + 0.5D, str, false);
for (int a = 0; a < blocksAffected; a++) {
int xx = x + world.rand.nextInt(size) - world.rand.nextInt(size);
int yy = y + world.rand.nextInt(size) - world.rand.nextInt(size);
int zz = z + world.rand.nextInt(size) - world.rand.nextInt(size);
if (world.isAirBlock(xx, yy, zz)) {
if (yy < y) {
world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGoo, 8, 3);
} else {
world.setBlock(xx, yy, zz, ConfigBlocks.blockFluxGas, 8, 3);
}
}
if(!Config.genTaint) continue;
if(taintBiome && world.rand.nextInt(chanceToTaint) == 0) {
Utils.setBiomeAt(world, xx, zz, ThaumcraftWorldGenerator.biomeTaint);
}
}
}
开发者ID:makeoo,项目名称:Gadomancy,代码行数:22,代码来源:ExplosionHelper.java
示例2: cleanseBiomeAroundTile
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
public static void cleanseBiomeAroundTile(TileEntity tile) {
if (!tile.getWorldObj().isRemote && tile.getWorldObj().rand.nextInt(35) == 0) {
int x = tile.getWorldObj().rand.nextInt(5) - 2;
int z = tile.getWorldObj().rand.nextInt(5) - 2;
int tileBiome = tile.getWorldObj().getBiomeGenForCoords(x + tile.xCoord, z + tile.zCoord).biomeID;
if (tileBiome == Config.biomeTaintID || tileBiome == Config.biomeEerieID || tileBiome == Config.biomeMagicalForestID) {
BiomeGenBase[] biomesForGeneration = null;
biomesForGeneration = tile.getWorldObj().getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, x + tile.xCoord, z + tile.zCoord, 1, 1);
if (biomesForGeneration != null && biomesForGeneration.length > 0 && biomesForGeneration[0] != null) {
BiomeGenBase biome = biomesForGeneration[0];
Utils.setBiomeAt(tile.getWorldObj(), x + tile.xCoord, z + tile.zCoord, biome);
}
}
}
}
开发者ID:CannibalVox,项目名称:NewRadicalBotany,代码行数:17,代码来源:BiomeCleanseSupport.java
示例3: onItemUse
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
@Override
public boolean onItemUse(ItemStack itemstack, EntityPlayer player, World world, int x, int y, int z, int par7, float par8, float par9, float par10) {
Block bi = world.getBlock(x, y, z);
if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) {
if (!world.isRemote) {
if (BlockUtils.breakFurthestBlock(world, x, y, z, bi, player)) {
world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);
ElectricItem.manager.use(itemstack, cost, player);
this.alternateServer = (!this.alternateServer);
}
} else {
player.swingItem();
ElectricItem.manager.use(itemstack, cost, player);
this.alternateClient = (!this.alternateClient);
}
}
return super.onItemUse(itemstack, player, world, x, y, z, par7, par8, par9, par10);
}
开发者ID:TeamAmeriFrance,项目名称:Electro-Magic-Tools,代码行数:19,代码来源:ItemStreamChainsaw.java
示例4: onBlockStartBreak
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
@Override
public boolean onBlockStartBreak(ItemStack itemstack, int x, int y, int z, EntityPlayer player) {
World world = player.worldObj;
Block bi = world.getBlock(x, y, z);
if ((!player.isSneaking()) && (Utils.isWoodLog(world, x, y, z))) {
if (!world.isRemote) {
BlockUtils.breakFurthestBlock(world, x, y, z, bi, player);
PacketHandler.INSTANCE.sendToAllAround(new PacketFXBlockBubble(x, y, z, new Color(0.33F, 0.33F, 1.0F).getRGB()), new NetworkRegistry.TargetPoint(world.provider.dimensionId, x, y, z, 32.0D));
world.playSoundEffect(x, y, z, "thaumcraft:bubble", 0.15F, 1.0F);
}
ElectricItem.manager.use(itemstack, cost, player);
return true;
}
return super.onBlockStartBreak(itemstack, x, y, z, player);
}
开发者ID:TeamAmeriFrance,项目名称:Electro-Magic-Tools,代码行数:17,代码来源:ItemStreamChainsaw.java
示例5: doBlockEffect
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
@Override
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
if(!Config.genTaint) return;
int x = selectedBlock.posX;
int y = selectedBlock.posY;
int z = selectedBlock.posZ;
BlockTaintFibres.spreadFibres(world, x, y, z);
if(world.rand.nextInt(12) == 0) {
Utils.setBiomeAt(world, x, z, ThaumcraftWorldGenerator.biomeTaint);
world.addBlockEvent(x, y, z, world.getBlock(x, y, z), 1, 0);
}
}
开发者ID:makeoo,项目名称:Gadomancy,代码行数:13,代码来源:AuraEffects.java
示例6: onImpact
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
@Override
protected void onImpact(MovingObjectPosition movingObjectPosition)
{
if (!worldObj.isRemote)
{
List entities = this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(this.posX, this.posY, this.posZ, this.posX, this.posY, this.posZ).expand(5.0D, 5.0D, 5.0D));
if (entities.size() > 0)
{
Iterator iterator = entities.iterator();
while (iterator.hasNext())
{
Object y = iterator.next();
EntityLivingBase entity = (EntityLivingBase) y;
if (entity instanceof ITaintedMob && !entity.isEntityUndead())
entity.addPotionEffect(new PotionEffect(CommonProxy.ethereal.getId(), 1200, 0, false));
}
}
int entityPosX = (int) this.posX;
int entityPosY = (int) this.posY;
int entityPosZ = (int) this.posZ;
for (int i = 0; i < 10; ++i)
{
int x = (int) ((this.rand.nextFloat() - this.rand.nextFloat()) * 5.0F);
int z = (int) ((this.rand.nextFloat() - this.rand.nextFloat()) * 5.0F);
if ((this.worldObj.getBiomeGenForCoords(x + entityPosX, z + entityPosZ).biomeID == Config.biomeTaintID || this.worldObj.getBiomeGenForCoords(x + entityPosX, z + entityPosZ).biomeID == Config.biomeEerieID || this.worldObj.getBiomeGenForCoords(x + entityPosX, z + entityPosZ).biomeID == Config.biomeMagicalForestID))
{
BiomeGenBase[] biomesForGeneration = null;
biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(biomesForGeneration, x + entityPosX, z + entityPosZ, 1, 1);
if (biomesForGeneration != null && biomesForGeneration[0] != null)
{
BiomeGenBase biome = biomesForGeneration[0];
if (biome.biomeID == ThaumcraftWorldGenerator.biomeTaint.biomeID)
{
biome = BiomeGenBase.plains;
}
Utils.setBiomeAt(this.worldObj, x + entityPosX, z + entityPosZ, biome);
worldObj.markBlockRangeForRenderUpdate(x + entityPosX, entityPosY - 1, z + entityPosZ, x + entityPosX + 16, entityPosY, z + entityPosZ + 16);
}
}
}
this.setDead();
} else
{
ThaumicThings.proxy.onBottleBreak(ThaumicThings.proxy.bottleEthereal, worldObj, posX, posY, posZ);
}
}
开发者ID:Thog,项目名称:ThaumicThings,代码行数:52,代码来源:EntityBottleEthereal.java
示例7: onEntityUpdate
import thaumcraft.common.lib.utils.Utils; //导入依赖的package包/类
@Override
public void onEntityUpdate() {
//Spread taint just like tainted nodes, but twice as fast
//TODO add a config option for speed, and a toggle?
tickCounter++;
if (this.dimension == 0 && tickCounter % 25 == 0) {
int y = 0;
int x = MathHelper.floor_double(this.posX - .5D) + worldObj.rand.nextInt(8) - worldObj.rand.nextInt(8);
int z = MathHelper.floor_double(this.posZ) + worldObj.rand.nextInt(8) - worldObj.rand.nextInt(8);
BiomeGenBase bg = worldObj.getBiomeGenForCoords(x, z);
if (bg.biomeID != ThaumcraftWorldGenerator.biomeTaint.biomeID) {
Utils.setBiomeAt(worldObj, x, z, ThaumcraftWorldGenerator.biomeTaint);
}
if ((Config.hardNode) && (worldObj.rand.nextBoolean())) {
x = MathHelper.floor_double(this.posX - .5D) + worldObj.rand.nextInt(5) - worldObj.rand.nextInt(5);
y = MathHelper.floor_double(this.posY) + worldObj.rand.nextInt(5) - worldObj.rand.nextInt(5);
z = MathHelper.floor_double(this.posZ) + worldObj.rand.nextInt(5) - worldObj.rand.nextInt(5);
BlockTaintFibres.spreadFibres(worldObj, x, y, z);
}
}
//Spawn a random aberration
int spawnChance = 4000; //nether portals spawn chance is 2000, though entities seem to update more often than blocks
if (!worldObj.isRemote && worldObj.provider.isSurfaceWorld() &&
worldObj.getGameRules().getGameRuleBooleanValue("doMobSpawning") &&
worldObj.rand.nextInt(spawnChance) < worldObj.difficultySetting.getDifficultyId()) {
//TODO change getTrackingRange to getModEntityId when the issue is fixed
int entityId = EntityRegistry.instance().lookupModSpawn(
FMLCommonHandler.instance().findContainerFor(Xthuoth.instance),
worldObj.rand.nextInt(ModEntities.maxAberrationId)).getTrackingRange();
Block blockBelow = worldObj.getBlock(MathHelper.floor_double(this.posX - .5D),
MathHelper.floor_double(this.posY) - 1, MathHelper.floor_double(this.posZ));
if (posY > 0 && blockBelow.isNormalCube()) {
Entity entity = ItemSpawnEgg.spawnCreature(worldObj, entityId, posX + 0.5D, posY + .5D, posZ + 0.5D);
if (entity != null) {
entity.timeUntilPortal = entity.getPortalCooldown();
}
}
}
}
开发者ID:Aurilux,项目名称:Xth-uoth,代码行数:43,代码来源:EntityRift.java
注:本文中的thaumcraft.common.lib.utils.Utils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论