本文整理汇总了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);
}
}
示例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);
}
}
}
示例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);
}
}
}
}
}
示例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);
}
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
}
示例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 );
}
}
示例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);
//}
}
}
示例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);
}
示例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;
}
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}