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


Java Result.DENY属性代码示例

本文整理汇总了Java中net.minecraftforge.event.Event.Result.DENY属性的典型用法代码示例。如果您正苦于以下问题:Java Result.DENY属性的具体用法?Java Result.DENY怎么用?Java Result.DENY使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraftforge.event.Event.Result的用法示例。


在下文中一共展示了Result.DENY属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBlockPlacedBy

@Override
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4,
		EntityLivingBase par5EntityLiving, ItemStack par6ItemStack) {
	EventCorePlaced event = new EventCorePlaced(par1World, par2, par3, par4, par5EntityLiving, this, 
			BlockPistonBase.determineOrientation(par1World, par2, par3, par4, par5EntityLiving));
	boolean ohyeah = MinecraftForge.EVENT_BUS.post(event);
	if(ohyeah || event.getResult() == Result.DENY)
	{
		par1World.setBlockToAir(par2, par3, par4);
		return;
	}
	par1World.setBlockMetadataWithNotify(par2, par3, par4, event.face, 4);
}
 
开发者ID:szszss,项目名称:MigoCraft,代码行数:13,代码来源:BlockCore.java

示例2: replaceBlocksForBiome

public void replaceBlocksForBiome(int chunkX, int chunkZ, byte[] byteArray, BiomeGenBase[] biomesForGeneration2) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, chunkX, chunkZ, byteArray, biomesForGeneration2);
	MinecraftForge.EVENT_BUS.post(event);
	
	if(event.getResult() == Result.DENY) return;
	
	byte b = 63;
	double d = 0.031250;
	this.stoneNoise = this.noiseGen4.generateNoiseOctaves(stoneNoise, chunkX*16, chunkZ*16, 0, 16, 16, 1, d*2D, d*2D, d*2D);

	for(int x = 0; x < 16; x++){
		for(int z = 0; z < 16; z++){
			BiomeGenBase biome = biomesForGeneration2[z + x*16];
			float temperature = biome.getFloatTemperature();
			int i = (int) (this.stoneNoise[z + x*16] / 3D + 3D + this.rand.nextDouble() * 0.25D);
			int j = -1;
			byte b1 = biome.topBlock;
			byte b2 = biome.fillerBlock;
			
			for(int k = 127; k >= 0; k--){
				int l = (z*16+x)*128+k;
				
				if(k <= this.rand.nextInt(3)){
					byteArray[l] = (byte)Block.bedrock.blockID;
				}else{
					byte b3 = byteArray[l];
					if(b3 == 0){
						j = -1;
					}else if(b3 == Block.stone.blockID){
						if(j == -1){
							if(i <= 0){
								b1 = 0;
								b2 = (byte)Block.stone.blockID;
							}else if(k >= b-2 && k <= b +1){//Generating Land
								b1 = biome.topBlock;
								b2 = biome.fillerBlock;
							}
							//Generating Water
							if(k < b && b1  == 0){
								if(temperature < 0.15F){
									b1 = (byte)Block.ice.blockID;
								}else{
									b1 = (byte)Block.waterStill.blockID;
								}
							}
							
							chunkZ = chunkX;
							
							if(k >= b-1){
								byteArray[l] = b1;
							}else{
								byteArray[l] = b2;
							}
						}else if(chunkZ>0){
							chunkZ--;
							
							byteArray[l] = b2;
							
							if(chunkZ == 0 && b2 == Block.sand.blockID){
								chunkZ = this.rand.nextInt(4);
								b2 = (byte)Block.sandStone.blockID;
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:MinecraftModArchive,项目名称:Runes-And-Silver,代码行数:69,代码来源:ChunkProviderCustomDimension.java

示例3: replaceBlocksForBiome

/**
 * Replaces the stone that was placed in with blocks that match the biome
 */
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY)
		return;

	byte averageSpawnYLevel = 63;
	double d0 = 0.03125D;
	this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[l + k * 16];
			float f = biomegenbase.getFloatTemperature();
			int i1 = (int) (this.stoneNoise[k + l * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D);
			int j1 = -1;
			byte topBlock = biomegenbase.topBlock;
			byte fillerBlock = biomegenbase.fillerBlock;
			
			for (int k1 = 127; k1 >= 0; --k1) {
				int l1 = (l * 16 + k) * 128 + k1;
				
				if(topBlock == (byte)FCraftBlocks.blockSandseaFluid.blockID && k1 > 62){
					topBlock = (byte)FCraftBlocks.sandseaSand.blockID;
					fillerBlock = (byte)FCraftBlocks.sandseaSand.blockID;		
				}
				
				if (k1 <= 0 + this.rand.nextInt(5)) {
					par3ArrayOfByte[l1] = (byte) Block.bedrock.blockID;
				} else {
					byte b3 = par3ArrayOfByte[l1];

					if (b3 == 0) {
						j1 = -1;
					} else if (b3 == Block.stone.blockID) {
						if (j1 == -1) {
							if (i1 <= 0) {
								topBlock = 0;
								fillerBlock = (byte) Block.dirt.blockID;//was dirt
							} else if (k1 >= averageSpawnYLevel - 4 && k1 <= averageSpawnYLevel + 1) {
								topBlock = biomegenbase.topBlock;
								fillerBlock = biomegenbase.fillerBlock;
							}

							if (k1 < averageSpawnYLevel && topBlock == 0) {
								if (f < 0.15F) {
									topBlock = (byte) Block.ice.blockID;
								}else {
									topBlock = (byte) Block.waterStill.blockID;
								}
							}

							j1 = i1;

							if (k1 >= averageSpawnYLevel - 1) {
								par3ArrayOfByte[l1] = topBlock;
							} else {
								par3ArrayOfByte[l1] = fillerBlock;
							}
						} else if (j1 > 0) {
							--j1;
							par3ArrayOfByte[l1] = fillerBlock;

							if (j1 == 0 && fillerBlock == FCraftBlocks.sandseaSand.blockID) {
								j1 = this.rand.nextInt(4);
								fillerBlock = (byte)FCraftBlocks.sandseaBlock.blockID;
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:Unrelentless,项目名称:FantasyCraft-Mod,代码行数:77,代码来源:ChunkProviderMultiBiome.java

示例4: despawnEntity

/**
 * Makes the entity despawn if requirements are reached
 */
protected void despawnEntity()
{
    Result result = null;
    if (this.persistenceRequired)
    {
        this.entityAge = 0;
    }
    else if ((this.entityAge & 0x1F) == 0x1F && (result = ForgeEventFactory.canEntityDespawn(this)) != Result.DEFAULT)
    {
        if (result == Result.DENY)
        {
            this.entityAge = 0;
        }
        else
        {
            this.setDead();
        }
    }
    else
    {
        EntityPlayer entityplayer = this.worldObj.getClosestPlayerToEntity(this, -1.0D);

        if (entityplayer != null)
        {
            double d0 = entityplayer.posX - this.posX;
            double d1 = entityplayer.posY - this.posY;
            double d2 = entityplayer.posZ - this.posZ;
            double d3 = d0 * d0 + d1 * d1 + d2 * d2;

            if (this.canDespawn() && d3 > 16384.0D)
            {
                this.setDead();
            }

            if (this.entityAge > 600 && this.rand.nextInt(800) == 0 && d3 > 1024.0D && this.canDespawn())
            {
                this.setDead();
            }
            else if (d3 < 1024.0D)
            {
                this.entityAge = 0;
            }
        }
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:48,代码来源:EntityLiving.java

示例5: attackEntityFrom

/**
 * Called when the entity is attacked.
 */
public boolean attackEntityFrom(DamageSource par1DamageSource, float par2)
{
    if (!super.attackEntityFrom(par1DamageSource, par2))
    {
        return false;
    }
    else
    {
        EntityLivingBase entitylivingbase = this.getAttackTarget();

        if (entitylivingbase == null && this.getEntityToAttack() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)this.getEntityToAttack();
        }

        if (entitylivingbase == null && par1DamageSource.getEntity() instanceof EntityLivingBase)
        {
            entitylivingbase = (EntityLivingBase)par1DamageSource.getEntity();
        }

        int i = MathHelper.floor_double(this.posX);
        int j = MathHelper.floor_double(this.posY);
        int k = MathHelper.floor_double(this.posZ);

        SummonAidEvent summonAid = ForgeEventFactory.fireZombieSummonAid(this, worldObj, i, j, k, entitylivingbase, this.getEntityAttribute(field_110186_bp).getAttributeValue());
        
        if (summonAid.getResult() == Result.DENY)
        {
            return true;
        }
        else if (summonAid.getResult() == Result.ALLOW || entitylivingbase != null && this.worldObj.difficultySetting >= 3 && (double)this.rand.nextFloat() < this.getEntityAttribute(field_110186_bp).getAttributeValue())
        {
            EntityZombie entityzombie;
            if (summonAid.customSummonedAid != null && summonAid.getResult() == Result.ALLOW)
            {
                entityzombie = summonAid.customSummonedAid;
            }
            else
            {
                entityzombie = new EntityZombie(this.worldObj);
            }
            
            for (int l = 0; l < 50; ++l)
            {
                int i1 = i + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int j1 = j + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);
                int k1 = k + MathHelper.getRandomIntegerInRange(this.rand, 7, 40) * MathHelper.getRandomIntegerInRange(this.rand, -1, 1);

                if (this.worldObj.doesBlockHaveSolidTopSurface(i1, j1 - 1, k1) && this.worldObj.getBlockLightValue(i1, j1, k1) < 10)
                {
                    entityzombie.setPosition((double)i1, (double)j1, (double)k1);

                    if (this.worldObj.checkNoEntityCollision(entityzombie.boundingBox) && this.worldObj.getCollidingBoundingBoxes(entityzombie, entityzombie.boundingBox).isEmpty() && !this.worldObj.isAnyLiquid(entityzombie.boundingBox))
                    {
                        this.worldObj.spawnEntityInWorld(entityzombie);
                        if (entitylivingbase != null) entityzombie.setAttackTarget(entitylivingbase);
                        entityzombie.onSpawnWithEgg((EntityLivingData)null);
                        this.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement caller charge", -0.05000000074505806D, 0));
                        entityzombie.getEntityAttribute(field_110186_bp).applyModifier(new AttributeModifier("Zombie reinforcement callee charge", -0.05000000074505806D, 0));
                        break;
                    }
                }
            }
        }

        return true;
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:71,代码来源:EntityZombie.java

示例6: replaceBlocksForBiome

/**
 * Replaces the stone that was placed in with blocks that match the biome
 */
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY)
		return;

	byte b0 = 63;
	double d0 = 0.03125D;
	this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[l + k * 16];
			float f = biomegenbase.getFloatTemperature();
			int i1 = (int) (this.stoneNoise[k + l * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D);
			int j1 = -1;
			byte b1 = biomegenbase.topBlock;
			byte b2 = biomegenbase.fillerBlock;

			for (int k1 = 127; k1 >= 0; --k1) {
				int l1 = (l * 16 + k) * 128 + k1;

				if (k1 <= 0 + this.rand.nextInt(5)) {
					par3ArrayOfByte[l1] = (byte) Block.bedrock.blockID;
				} else {
					byte b3 = par3ArrayOfByte[l1];

					if (b3 == 0) {
						j1 = -1;
					} else if (b3 == Block.stone.blockID) {
						if (j1 == -1) {
							if (i1 <= 0) {
								b1 = 0;
								b2 = (byte) Block.stone.blockID;
							} else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
								b1 = biomegenbase.topBlock;
								b2 = biomegenbase.fillerBlock;
							}

							if (k1 < b0 && b1 == 0) {
								if (f < 0.15F) {
									b1 = (byte) Block.ice.blockID;
								} else {
									b1 = (byte) Block.waterStill.blockID;
								}
							}

							j1 = i1;

							if (k1 >= b0 - 1) {
								par3ArrayOfByte[l1] = b1;
							} else {
								par3ArrayOfByte[l1] = b2;
							}
						} else if (j1 > 0) {
							--j1;
							par3ArrayOfByte[l1] = b2;

							if (j1 == 0 && b2 == Block.sand.blockID) {
								j1 = this.rand.nextInt(4);
								b2 = (byte) Block.sandStone.blockID;
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:ChistaMisuto,项目名称:Eldritch-Infusion,代码行数:72,代码来源:ChunkProviderEI.java

示例7: replaceBlocksForBiome

/**
 * Replaces the stone that was placed in with blocks that match the biome
 */
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {

	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2,
			par3ArrayOfByte, par4ArrayOfBiomeGenBase);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY) {
		return;
	}

	byte b0 = 63;
	double d0 = 0.03125D;
	stoneNoise = noiseGen4.generateNoiseOctaves(stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D,
			d0 * 2.0D, d0 * 2.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[l + k * 16];
			float f = biomegenbase.getFloatTemperature();
			int i1 = (int) (stoneNoise[k + l * 16] / 3.0D + 3.0D + rand.nextDouble() * 0.25D);
			int j1 = -1;
			byte b1 = biomegenbase.topBlock;
			byte b2 = biomegenbase.fillerBlock;

			for (int k1 = 127; k1 >= 0; --k1) {
				int l1 = (l * 16 + k) * 128 + k1;

				if (k1 <= 0 + rand.nextInt(5)) {
					par3ArrayOfByte[l1] = (byte) Block.bedrock.blockID;
				} else {
					byte b3 = par3ArrayOfByte[l1];

					if (b3 == 0) {
						j1 = -1;
					} else if (b3 == BlockIds.GRANITE) {
						if (j1 == -1) {
							if (i1 <= 0) {
								b1 = 0;
								b2 = (byte) BlockIds.GRANITE;
							} else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
								b1 = biomegenbase.topBlock;
								b2 = biomegenbase.fillerBlock;
							}

							if (k1 < b0 && b1 == 0) {
								if (f < 0.15F) {
									b1 = (byte) Block.ice.blockID;
								} else {
									b1 = (byte) Block.waterStill.blockID;
								}
							}

							j1 = i1;

							if (k1 >= b0 - 1) {
								par3ArrayOfByte[l1] = b1;
							} else {
								par3ArrayOfByte[l1] = b2;
							}
						} else if (j1 > 0) {
							--j1;
							par3ArrayOfByte[l1] = b2;

							if (j1 == 0 && b2 == Block.sand.blockID) {
								j1 = rand.nextInt(4);
								b2 = (byte) Block.sandStone.blockID;
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:VitezKolya,项目名称:AltEnergy,代码行数:76,代码来源:ChunkProviderTerra.java

示例8: replaceBlocksForBiome

/**
 * Replaces the stone that was placed in with blocks that match the biome
 */
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY)
		return;

	byte b0 = 63;
	double d0 = 0.03125D;
	this.stoneNoise = this.noiseGen4.generateNoiseOctaves(this.stoneNoise, par1 * 16, par2 * 16, 0, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = par4ArrayOfBiomeGenBase[l + k * 16];
			float f = biomegenbase.getFloatTemperature();
			int i1 = (int) (this.stoneNoise[k + l * 16] / 3.0D + 3.0D + this.rand.nextDouble() * 0.25D);
			int j1 = -1;
			byte b1 = biomegenbase.topBlock;
			byte b2 = biomegenbase.fillerBlock;

			for (int k1 = 127; k1 >= 0; --k1) {
				int l1 = (l * 16 + k) * 128 + k1;

				if (k1 <= 0 + this.rand.nextInt(5)) {
					par3ArrayOfByte[l1] = (byte) Block.bedrock.blockID;
				} else {
					byte b3 = par3ArrayOfByte[l1];

					if (b3 == 0) {
						j1 = -1;
					} else if (b3 == Block.glowStone.blockID) {
						if (j1 == -1) {
							if (i1 <= 0) {
								b1 = 0;
								b2 = (byte) Block.dirt.blockID;//was dirt
							} else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
								b1 = biomegenbase.topBlock;
								b2 = biomegenbase.fillerBlock;
							}

							if (k1 < b0 && b1 == 0) {
								if (f < 0.15F) {
									b1 = (byte) Block.ice.blockID;
								} else {
									b1 = (byte) Fluids.blockRasterWasser.blockID;
								}
							}

							j1 = i1;

							if (k1 >= b0 - 1) {
								par3ArrayOfByte[l1] = b1;
							} else {
								par3ArrayOfByte[l1] = b2;
							}
						} else if (j1 > 0) {
							--j1;
							par3ArrayOfByte[l1] = b2;

							if (j1 == 0 && b2 == Block.sand.blockID) {
								j1 = this.rand.nextInt(4);
								b2 = (byte) Block.sandStone.blockID;
							}
						}
					}
				}
			}
		}
	}
}
 
开发者ID:mrgregfinch,项目名称:powell.cellarium,代码行数:72,代码来源:RasterlandChunkProvider.java


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