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


Java Result类代码示例

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


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

示例1: fertellise

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void fertellise (BonemealEvent event)
{
	World world = event.world;
	EntityPlayer player = event.entityPlayer;
	int x = event.X;
	int y = event.Y;
	int z = event.Z;
	int id = event.ID;
	ItemStack item = player.getHeldItem();
	int meta = world.getBlockMetadata(x, y, z);
	
	if (id == BlockListMF.sapling.blockID)
       {
           if (!world.isRemote)
           {
               if ((double)world.rand.nextFloat() < ((BlockSaplingMF)BlockListMF.sapling).getBonemealChance(meta))
               {
                   ((BlockSaplingMF)BlockListMF.sapling).markOrGrowMarked(world, x, y, z, world.rand);
               }
           }

           event.setResult(Result.ALLOW);
       }
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:26,代码来源:EventManagerMF.java

示例2: handleBonemeal

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void handleBonemeal(BonemealEvent event) {

	if (!Proxies.common.isSimulating(event.world))
		return;

	TileEntity tile = event.world.getBlockTileEntity(event.X, event.Y, event.Z);
	if (tile instanceof TileSapling) {
		if (((TileSapling) tile).tryGrow(true)) {
			event.setResult(Result.ALLOW);
		}
	} else if(tile instanceof IFruitBearer) {
		IFruitBearer bearer = (IFruitBearer)tile;
		if(bearer.getRipeness() <= 1.0f) {
			bearer.addRipeness(1.0f);
			event.setResult(Result.ALLOW);
		}
	}
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:20,代码来源:EventHandlerArboriculture.java

示例3: bucketFill

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
/**
 * Called by ItemBucket when it tries to fill a bucket
 * @param evt
 */
public void bucketFill(FillBucketEvent evt) {
    if (evt.current.getItem().equals(Item.bucketEmpty) && evt.target.typeOfHit == EnumMovingObjectType.TILE) {
        if (evt.world.canMineBlock(evt.entityPlayer, evt.target.blockX, evt.target.blockY, evt.target.blockZ)) {
            if (evt.entityPlayer.canPlayerEdit(evt.target.blockX, evt.target.blockY, evt.target.blockZ, evt.target.sideHit, evt.current)) {
                if (evt.world.getBlockId(evt.target.blockX, evt.target.blockY, evt.target.blockZ) == blockID) {
                    evt.world.setBlockToAir(evt.target.blockX, evt.target.blockY, evt.target.blockZ);
                    evt.result = new ItemStack(Magitech.instance.magibucket);
                    evt.setResult(Result.ALLOW);
                }
            }
        }
    }
}
 
开发者ID:froschi3b,项目名称:Magitech,代码行数:19,代码来源:BlockMagi.java

示例4: onUseBonemeal

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onUseBonemeal(BonemealEvent event) {
    if (event.ID == ModBlocks.blockOrangeTreeSapling.blockID) {
        if (!event.world.isRemote) {
            ((OrangeTreeSapling) ModBlocks.blockOrangeTreeSapling).generateTree(event.world, event.X, event.Y, event.Z, event.world.rand, event.world.getBlockMetadata(event.X, event.Y, event.Z));
            event.setResult(Result.ALLOW);
        }
    }

    if (event.ID == ModBlocks.blockOrangeTreeOrange.blockID) {
        if (!event.world.isRemote) {
            ((OrangeTreeOrange) ModBlocks.blockOrangeTreeOrange).fertilize(event.world, event.X, event.Y, event.Z);
            event.setResult(Result.ALLOW);
        }
    }
}
 
开发者ID:Grimlock257,项目名称:JaffaCakes,代码行数:17,代码来源:OrangeTreeBonemealEvent.java

示例5: onUseBonemeal

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
	public boolean onUseBonemeal(BonemealEvent event){
		
		if(event.world.isRemote)
			return true;

		
		if(event.ID == ModBlocks.dreamSaplings.blockID)
		{
			((BlockDreamSaplings)(ModBlocks.dreamSaplings)).growTree(event.world, event.X, event.Y, event.Z, new Random());
			event.setResult(Result.ALLOW);
		}
		/*
		   if(id == ModBlocks.dreamPlants.blockID)
		{
			if(event.world.getBlockMetadata(event.X, event.Y, event.Z) < 5)
			{
				((BlockDreamPlants)(ModBlocks.dreamPlants)).fertilize(event.world, event.X, event.Y, event.Z);
				event.setResult(Result.ALLOW);
			}
		}
*/
		return false;
	}
 
开发者ID:JennyLeeP,项目名称:JLPModJam,代码行数:25,代码来源:DreamLand_EventBonemeal.java

示例6: onBoneMeal

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onBoneMeal(final BonemealEvent event)
{
    final Block block = Block.blocksList[event.ID];
    if (block instanceof BlockCrop)
    {
        if (((BlockCrop) block).fertilize(event.world, event.X, event.Y, event.Z))
        {
            event.setResult(Result.ALLOW);
        }
        else
        {
            event.setCanceled(true);
        }
    }
}
 
开发者ID:TeamMetallurgy,项目名称:Agriculture,代码行数:17,代码来源:ExtraIcons.java

示例7: onBonmealEvent

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onBonmealEvent(BonemealEvent event){
	
	int meta = event.world.getBlockMetadata(event.X, event.Y, event.Z);
	
	if(!event.world.isRemote){
		
		if(event.getResult() == Result.DEFAULT && event.ID == Blocks.blockSaplings.blockID){
			
				if(meta == 0){
					
				if ((double)event.world.rand.nextFloat() > 0.15D){
					((BlockSaplings)Blocks.blockSaplings).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
				}
			
				event.setResult(Result.ALLOW);
			}
		}
	}
}
 
开发者ID:Rasmustof,项目名称:Kitchenmod,代码行数:21,代码来源:BonemealHandler.java

示例8: onBucketFill

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onBucketFill(FillBucketEvent event) // NO_UCD (unused code)
{
    ItemStack result = fillCustomBucket( event.world,
                                         event.target );

    if (result != null)
    {
        event.result = result;
        event.setResult( Result.ALLOW );
    }
}
 
开发者ID:Maxwolf,项目名称:MC-MineAPI.Java,代码行数:13,代码来源:FluidBucketTemplate.java

示例9: onBonemealClick

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onBonemealClick(BonemealEvent event) 
{
	if (event.ID == mod_Rediscovered.CherrySapling.blockID) 
	{
		event.setResult(Result.ALLOW);
		//if(itemRand.nextInt(2) == 0)
		//{
			//grow tree
			((BlockCherrySapling)mod_Rediscovered.CherrySapling).markOrGrowMarked(event.world, event.X, event.Y, event.Z, event.world.rand);
			
		//}
	}
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:15,代码来源:RediscoveredEventHandler.java

示例10: handleBonemeal

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void handleBonemeal(BonemealEvent event) {

	if (!Proxies.common.isSimulating(event.world))
		return;

	int blockid = event.world.getBlockId(event.X, event.Y, event.Z);
	if(blockid != ForestryBlock.mushroom.blockID)
		return;
	
	((BlockMushroom)ForestryBlock.mushroom).growTree(event.world, event.X, event.Y, event.Z, event.world.rand);
	event.setResult(Result.ALLOW);
}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:14,代码来源:EventHandlerFarming.java

示例11: handleItemPickup

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void handleItemPickup(EntityItemPickupEvent event) {

	if (event.isCanceled())
		return;

	for (IPickupHandler handler : PluginManager.pickupHandlers) {
		if (!handler.onItemPickup(event.entityPlayer, event.item)) {
			event.setResult(Result.ALLOW);
			return;
		}
	}

}
 
开发者ID:ForestryMC,项目名称:ForestryLegacy,代码行数:15,代码来源:EventHandlerCore.java

示例12: onBucketFill

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onBucketFill(FillBucketEvent event) {

    ItemStack result = fillCustomBucket(event.world, event.target);

    if (result == null)
        return;

    event.result = result;
    event.setResult(Result.ALLOW);
}
 
开发者ID:lombax5832,项目名称:BL2,代码行数:12,代码来源:RefinedEridiumBucketHelper.java

示例13: onBucketFill

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe
public void onBucketFill(FillBucketEvent event) {

	ItemStack result = fillCustomBucket(event.world, event.target);

	if (result == null)
		return;

	event.result = result;
	event.setResult(Result.ALLOW);
}
 
开发者ID:sciguy1121,项目名称:Community-Mod-1,代码行数:12,代码来源:ConcreteBucketHandler.java

示例14: onBlockPlacedBy

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@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,代码行数:14,代码来源:BlockCore.java

示例15: FillBucket

import net.minecraftforge.event.Event.Result; //导入依赖的package包/类
@ForgeSubscribe(priority = EventPriority.NORMAL)
public void FillBucket(FillBucketEvent event) {
	ItemStack result = attemptFill(event.world, event.target);
	if (result != null) {
		event.result = result;
		event.setResult(Result.ALLOW);
	}
}
 
开发者ID:PaleoCrafter,项目名称:PowerGrid,代码行数:9,代码来源:ItemEnergonBucket.java


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