當前位置: 首頁>>代碼示例>>Java>>正文


Java Result類代碼示例

本文整理匯總了Java中cpw.mods.fml.common.eventhandler.Event.Result的典型用法代碼示例。如果您正苦於以下問題:Java Result類的具體用法?Java Result怎麽用?Java Result使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Result類屬於cpw.mods.fml.common.eventhandler.Event包,在下文中一共展示了Result類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onZombieSummonAid

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent
public void onZombieSummonAid(SummonAidEvent event)
{
    if (event.entity instanceof EntityEvolvedZombie)
    {
        event.customSummonedAid = new EntityEvolvedZombie(event.world);

        if (((EntityLivingBase) event.entity).getRNG().nextFloat() < ((EntityEvolvedZombie) event.entity).getEntityAttribute(((EntityEvolvedZombie) event.entity).getReinforcementsAttribute()).getAttributeValue())
        {
            event.setResult(Result.ALLOW);
        }
        else
        {
            event.setResult(Result.DENY);
        }
    }
}
 
開發者ID:4Space,項目名稱:4Space-5,代碼行數:18,代碼來源:EventHandlerGC.java

示例2: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_5_);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY) {
		return;
	}

	double d0 = 0.03125D;
	this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, p_147422_1_ * 16, p_147422_2_ * 16, 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = p_147422_5_[(l + k * 16)];
			
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[(l + k * 16)]);
		}
	}

}
 
開發者ID:kormic911,項目名稱:EvilOcean,代碼行數:20,代碼來源:ChunkProviderOcean.java

示例3: func_151557_c

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
protected int func_151557_c(Block p_151557_1_, int p_151557_2_)
{
    BiomeEvent.GetVillageBlockMeta event = new BiomeEvent.GetVillageBlockMeta(startPiece == null ? null : startPiece.biome, p_151557_1_, p_151557_2_);
    MinecraftForge.TERRAIN_GEN_BUS.post(event);
    if (event.getResult() == Result.DENY) return event.replacement;
    if (this.field_143014_b)
    {
        if (p_151557_1_ == Blocks.log || p_151557_1_ == Blocks.log2)
        {
            return 0;
        }

        if (p_151557_1_ == Blocks.cobblestone)
        {
            return 0;
        }

        if (p_151557_1_ == Blocks.planks)
        {
            return 2;
        }
    }

    return p_151557_2_;
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:26,代碼來源:StructureVillagePieces.java

示例4: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
	GameLogHelper.writeToLog(Level.INFO, "Replacing block for biome.");
	@SuppressWarnings("deprecation")
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, blocks, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY) return;
	double d0 = 0.03125D;
	this.stoneNoise = this.noisePerl.func_151599_a(this.stoneNoise, (double)(par1 * 16), (double)(par2 * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
	/*for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenPat biomegenbase = (BiomeGenPat) par4ArrayOfBiomeGenBase[l + k * 16];
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, blocks, par3ArrayOfByte, par1 * 16 + k, par2 * 16 + l, this.stoneNoise[l + k * 16]);
		}
		for (int l = 0; l < 8; ++l) {
			BiomeGenJen biomegenbase = (BiomeGenJen) par4ArrayOfBiomeGenBase[l + k * 16];
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, blocks, par3ArrayOfByte, par1 * 16 + k, par2 * 16 + l, this.stoneNoise[l + k * 16]);
		}
	}*/
}
 
開發者ID:jtrent238,項目名稱:PopularMMOS-EpicProportions-Mod,代碼行數:20,代碼來源:ChunkProviderEpic.java

示例5: onWorldDecoration

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event) 
{
	if ((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS) 
	{
		for(int i = 0; i < 2; i++) 
		{
			int x = event.chunkX + event.rand.nextInt(16) + 8;
			int z = event.chunkZ + event.rand.nextInt(16) + 8;
			int y = event.world.getTopSolidOrLiquidBlock(x, z);

			if(event.world.isAirBlock(x, y, z) && Blocks.flower_pot.canBlockStay(event.world, x, y, z) && ConfigPrimitiveCraft.genrocks)
			{
				event.world.setBlock(x, y, z, ModBlocks.rock);
			}
			else if(event.world.getBlock(x, y, z) == Blocks.water && ConfigPrimitiveCraft.genshale)
			{
				event.world.setBlock(x, y-1, z, ModBlocks.shale);
			}
		}
	}
}
 
開發者ID:gigabit101,項目名稱:PrimitiveCraft,代碼行數:23,代碼來源:WorldGenStones.java

示例6: onEntityJoinWorldEvent

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent
	public void onEntityJoinWorldEvent(EntityJoinWorldEvent event) {
		if (event.entity instanceof EntityGuard){
			EntityGuard guard = (EntityGuard) event.entity;
	    	// If spawned by WorldGen, it will not be looking for home
	    	if (guard.isLookingForHome()) {
	    		if (okToSpawnNearVillage(event, 50)) {
//		    		LogHelper.info("EntityJoinWorldEvent: Do spawn " + guard.getGuardType() + " at: " + guard.posX + ", " + guard.posY + ", " + guard.posZ);
	    			// If I set to ALLOW, need to do all own checks here, so use DEFAULT
		    		event.setResult(Result.DEFAULT);
		    	}
		    	else {
		    		// Prevents spawns not in a village 
//		    		LogHelper.info("onLivingCheckSpawnEvent: Don't spawn Guard at: " + guard.posX + ", " + guard.posY + ", " + guard.posZ);
		    		event.setResult(Result.DENY);	    		
		    	}
	    	}
		}
	}
 
開發者ID:DracoAnimus,項目名稱:Coding,代碼行數:20,代碼來源:EntityGuardEventHandler.java

示例7: use

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent
public void use(PlayerInteractEvent event){
	ItemStack item = event.entityPlayer.getEquipmentInSlot(0);
	if(item == null)
		return;
	if(item.hasTagCompound())
		if(item.getTagCompound().hasKey("Fidelis"))
		{
			String fidelisID = item.getTagCompound().getString("Fidelis");
			if(event.entityPlayer.getGameProfile().getId().toString().equals(fidelisID))
				return;
			else if(fidelisID.equals(""))
			{
				item.getTagCompound().setString("Fidelis", event.entityPlayer.getGameProfile().getId().toString());
				item.getTagCompound().setString("FidelisDisplay", event.entityPlayer.getDisplayName());
			}
			else{
				event.setCanceled(true);
				event.useItem = Result.DENY;
			}
		}
}
 
開發者ID:UnderMybrella,項目名稱:Fidelis,代碼行數:23,代碼來源:Fidelis.java

示例8: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
{
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY) return;

	double d0 = 0.03125D;
	this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

	for (int k = 0; k < 16; ++k)
	{
		for (int l = 0; l < 16; ++l)
		{
			BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
		}
	}
}
 
開發者ID:Alex-the-666,項目名稱:It-s-About-Time-Minecraft-Mod,代碼行數:19,代碼來源:ChunkProviderNowhere.java

示例9: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
{
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_, this.worldObj);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY) return;

	double d0 = 0.03125D;
	this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

	for (int k = 0; k < 16; ++k)
	{
		for (int l = 0; l < 16; ++l)
		{
			BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
		}
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:19,代碼來源:ChunkProviderPlanet.java

示例10: onWorldGen

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent
public void onWorldGen(OreGenEvent.GenerateMinable event) {

	if(event.world.provider instanceof WorldProviderPlanet && 
			DimensionManager.getInstance().getDimensionProperties(event.world.provider.dimensionId).getOreGenProperties(event.world) != null) {

		switch(event.type) {
		case COAL:
		case DIAMOND:
		case GOLD:
		case IRON:
		case LAPIS:
		case QUARTZ:
		case REDSTONE:
		case CUSTOM:
			event.setResult(Result.DENY);
			break;
		default:
			event.setResult(Result.DEFAULT);
		}
	}
}
 
開發者ID:zmaster587,項目名稱:AdvancedRocketry,代碼行數:23,代碼來源:PlanetEventHandler.java

示例11: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SuppressWarnings("deprecation")
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_) {
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_);
	MinecraftForge.EVENT_BUS.post(event);
	if (event.getResult() == Result.DENY)
		return;

	double d0 = 0.03125D;
	this.stoneNoise = this.noiseGen4.func_151599_a(this.stoneNoise, (double) (p_147422_1_ * 16), (double) (p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

	for (int k = 0; k < 16; ++k) {
		for (int l = 0; l < 16; ++l) {
			BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
		}
	}
}
 
開發者ID:TheDarkEra,項目名稱:TheDarkEra,代碼行數:18,代碼來源:TDEChunkProvider.java

示例12: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
{
    ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_5_);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.getResult() == Result.DENY) return;

    double d0 = 0.03125D;
    this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

    for (int k = 0; k < 16; ++k)
    {
        for (int l = 0; l < 16; ++l)
        {
            BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
            biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
        }
    }
}
 
開發者ID:CodecademyMinecraftMods,項目名稱:atlantis-mod,代碼行數:19,代碼來源:ChunkProviderTheDeep.java

示例13: interact

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent
public void interact(PlayerInteractEvent evt){

	EntityPlayer p = evt.entityPlayer;
	PlayerRpgInventory inv = PlayerRpgInventory.get(p);
	ItemStack shield = inv.getShield();

	if(shield == null)
		return;

	ItemRpgInvArmor theShield = (ItemRpgInvArmor) shield.getItem();

	if(inv.isBlocking() && p.isSneaking()){
		evt.setResult(Result.DENY);
		evt.setCanceled(true);
	}
}
 
開發者ID:ArtixAllMighty,項目名稱:rpginventory,代碼行數:18,代碼來源:RPGEventHooks.java

示例14: replaceBlocksForBiome

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
{
    ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_, this.worldObj);
    MinecraftForge.EVENT_BUS.post(event);
    if (event.getResult() == Result.DENY) return;

    double d0 = 0.03125D;
    this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);

    for (int k = 0; k < 16; ++k)
    {
        for (int l = 0; l < 16; ++l)
        {
            BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
            biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
        }
    }
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:19,代碼來源:ChunkProviderNillax.java

示例15: genOre

import cpw.mods.fml.common.eventhandler.Event.Result; //導入依賴的package包/類
@SubscribeEvent
public void genOre(GenerateMinable event) {
	switch (event.type) {
	//case EMERALD:
	case QUARTZ:
	case IRON:
	case GOLD:
	case LAPIS:
	case REDSTONE:
	case DIAMOND:
	case COAL:
		event.setResult(Result.DENY);
		break;
	default:
		event.setResult(Result.ALLOW);
	}
}
 
開發者ID:TheTorbinWren,項目名稱:OresPlus,代碼行數:18,代碼來源:OreEventHandler.java


注:本文中的cpw.mods.fml.common.eventhandler.Event.Result類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。