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


Java Result.DENY属性代码示例

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


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

示例1: onItemUseFirst

@Override  
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
	if (world.isRemote) {
      //If its client side we have to return pass so this method is called on server, where we need to perform the op 
      return EnumActionResult.PASS;
    }
	final IBlockState blockState = world.getBlockState(pos);
	IBlockState bs = blockState;
	Block block = bs.getBlock();
	boolean ret = false;
	if (block != null) {
		RightClickBlock e = new RightClickBlock(player, hand, pos,side, new Vec3d(hitX, hitY, hitZ));
		if (MinecraftForge.EVENT_BUS.post(e) || e.getResult() == Result.DENY || e.getUseBlock() == Result.DENY || e.getUseItem() == Result.DENY) {
			return EnumActionResult.PASS;
		}
		if (!player.isSneaking() && block.rotateBlock(world, pos, side)) {
			ret = true;
		} 
   	}
	if (ret) {
		player.swingArm(hand);
	}
	return (ret && !world.isRemote) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:ItemCrystalWrench.java

示例2: func_180517_a

public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
{
	ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_,
			p_180517_2_, p_180517_3_, 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_180517_1_ * 16),
			(double) (p_180517_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_180517_4_[l + k * 16];
			biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k,
					p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]);
		}
	}
}
 
开发者ID:sokratis12GR,项目名称:MoreDimensions,代码行数:22,代码来源:CoalDimension.java

示例3: func_180517_a

public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
{
    ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, 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_180517_1_ * 16), (double)(p_180517_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_180517_4_[l + k * 16];
            biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k, p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]);
        }
    }
}
 
开发者ID:NovaViper,项目名称:ZeroQuest,代码行数:18,代码来源:ChunkProviderNillax.java

示例4: wasBombEaten

/**
 * Returns true if any nearby {@link IEntityBombEater} consumes this bomb
 */
private boolean wasBombEaten() {
	List<EntityLivingBase> entities = worldObj.getEntitiesWithinAABB(EntityLivingBase.class, getEntityBoundingBox().expand(0.5D, 0.5D, 0.5D));
	for (EntityLivingBase entity : entities) {
		if (!entity.isEntityAlive()) {
			continue;
		}
		Result result = (entity instanceof IEntityBombEater ? ((IEntityBombEater) entity).ingestBomb(this) : Result.DENY);
		if (result == Result.ALLOW) {
			return true;
		} else if (result == Result.DEFAULT && ZSSEntityInfo.get(entity).onBombIngested(this)) {
			return true;
		}
	}
	return false;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:18,代码来源:EntityBomb.java

示例5: shouldSwing

@Override
public Result shouldSwing(EntityWhip whip, World world, BlockPos pos, int ticksInGround) {
	if (ticksInGround > 30 && world.getBlockState(pos).getValue(AGE).intValue() == 7) {
		EntityLivingBase thrower = whip.getThrower();
		EntityItem bomb = new EntityItem(world, whip.posX, whip.posY + 1, whip.posZ, new ItemStack(ZSSItems.bomb, 1, BombType.BOMB_FLOWER.ordinal()));
		double dx = thrower.posX - bomb.posX;
		double dy = (thrower.posY + thrower.getEyeHeight()) - (bomb.posY - 1);
		double dz = thrower.posZ - bomb.posZ;
		TargetUtils.setEntityHeading(bomb, dx, dy + 0.5D, dz, 1.0F, 0.0F, true);
		if (!world.isRemote) {
			world.spawnEntityInWorld(bomb);
		}
		world.setBlockToAir(pos);
		whip.setDead();
	}
	return Result.DENY;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:17,代码来源:BlockBombFlower.java

示例6: shouldSwing

@Override
public Result shouldSwing(EntityWhip whip, World world, BlockPos pos, int ticksInGround) {
	if (ticksInGround > 30) {
		EntityLivingBase thrower = whip.getThrower();
		EntityCeramicJar jar = new EntityCeramicJar(world, whip.posX, whip.posY + 1, whip.posZ);
		double dx = thrower.posX - jar.posX;
		double dy = (thrower.posY + thrower.getEyeHeight()) - (jar.posY - 1);
		double dz = thrower.posZ - jar.posZ;
		TargetUtils.setEntityHeading(jar, dx, dy + 0.5D, dz, 1.0F, 0.0F, true);
		TileEntity te = world.getTileEntity(pos);
		if (te instanceof IInventory) {
			ItemStack stack = ((IInventory) te).getStackInSlot(0);
			if (stack != null) {
				jar.setStack(stack);
			}
		}
		if (!world.isRemote) {
			world.spawnEntityInWorld(jar);
		}
		keepInventory = true; // don't drop items from breakBlock
		world.setBlockToAir(pos);
		keepInventory = false;
		whip.setDead();
	}
	return Result.DENY;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:26,代码来源:BlockCeramicJar.java

示例7: onEntitySpawn

@SubscribeEvent
public void onEntitySpawn(LivingSpawnEvent.CheckSpawn evt) {
  if (evt.getResult() == Result.DENY) {
    return;
  }
  
  if(Config.spawnGuardStopAllSlimesDebug && evt.getEntity() instanceof EntitySlime) {
    evt.setResult(Result.DENY);
    return;
  }
  if(Config.spawnGuardStopAllSquidSpawning && evt.getEntity().getClass() == EntitySquid.class) {
    evt.setResult(Result.DENY);
    return;
  }
  
  Map<BlockPos, ISpawnCallback> guards = getGuardsForWorld(evt.getWorld());
  for (ISpawnCallback guard : guards.values()) {
    ISpawnCallback.Result result = guard.isSpawnPrevented(evt.getEntityLiving());
    if (result == ISpawnCallback.Result.DENY) {
      evt.setResult(Result.DENY);
      return;
    } else if (result == ISpawnCallback.Result.DONE) {
      return;
    }
  }    
}
 
开发者ID:SleepyTrousers,项目名称:EnderIO,代码行数:26,代码来源:SpawningObeliskController.java

示例8: findReplacement

/**
 * Invokes the Forge events to figure out any block replacements due to
 * themes.
 */
public static IBlockState findReplacement(final BiomeGenBase biome, final IBlockState state) {
	// Ask subscribers if they want to replace
	final BiomeEvent.GetVillageBlockID event1 = new BiomeEvent.GetVillageBlockID(biome, state);
	MinecraftForge.TERRAIN_GEN_BUS.post(event1);
	if (event1.getResult() == Result.DENY)
		return event1.replacement;
	return state;
}
 
开发者ID:OreCruncher,项目名称:Restructured,代码行数:12,代码来源:BlockThemes.java

示例9: blockReplaceEvent

@SubscribeEvent(priority = EventPriority.LOW)
public void blockReplaceEvent(final BiomeEvent.GetVillageBlockID event) {
	if (event.getResult() == Result.DENY)
		return;
	final Map<Block, ThemeBlock> replacements = themes.get(event.biome);
	if (replacements == null)
		return;

	// Crack the block portion
	final IBlockState original = event.original;
	final ThemeBlock theme = replacements.get(original.getBlock());
	if (theme == null)
		return;

	final Block newBlock = theme.getBlock();

	// Handle the meta
	int newMeta = theme.getMeta();
	if (newMeta != KEEP_META) {
		// Preserve slab orientation
		if (theme.isSlab())
			newMeta |= (theme.getMeta() & 8);
		// Preserve log orientation
		else if (theme.isLog())
			newMeta |= (theme.getMeta() & 12);
	} else {
		newMeta = original.getBlock().getMetaFromState(original);
	}

	event.replacement = newBlock.getStateFromMeta(newMeta);
	event.setResult(Result.DENY);
}
 
开发者ID:OreCruncher,项目名称:Restructured,代码行数:32,代码来源:BlockThemes.java

示例10: func_180517_a

public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_) {
	 ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj);
     MinecraftForge.EVENT_BUS.post(event);
     if (event.getResult() == Result.DENY) return;
     
     for (int k = 0; k < 16; ++k) {
         for (int l = 0; l < 16; ++l) {
             BiomeGenBase biomegenbase = p_180517_4_[l + k * 16];
             biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k, p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]);
         }
     }
}
 
开发者ID:TEAMModding,项目名称:FutureCraft,代码行数:12,代码来源:ChunkProviderPlanet.java

示例11: onEvent

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEvent(PlayerInteractEvent event) {
    if (event.getPos() != null) {
        IBlockState state = event.getWorld().getBlockState(event.getPos());
        Block block = state.getBlock();
        int meta = block.getMetaFromState(state);

        if (ProgressionAPI.registry.fireTrigger(event.getEntityPlayer(), getProvider().getUnlocalisedName(), block, meta) == Result.DENY) {
            event.setCanceled(true);
        }
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:12,代码来源:TriggerClickBlock.java

示例12: onEvent

@SubscribeEvent(priority = EventPriority.LOWEST)
public void onEvent(BreakEvent event) {
    Block block = event.getState().getBlock();
    int meta = block.getMetaFromState(event.getState());
    if (ProgressionAPI.registry.fireTrigger(event.getPlayer(), getProvider().getUnlocalisedName(), block, meta) == Result.DENY) {
        event.setCanceled(true);
    }
}
 
开发者ID:joshiejack,项目名称:Progression,代码行数:8,代码来源:TriggerBreakBlock.java

示例13: canInteractConvert

@Override
public Result canInteractConvert(EntityPlayer player, EntityVillager villager) {
	if (player.worldObj.isRemote || villager.getClass() != EntityVillager.class || villager.isChild()) {
		return Result.DEFAULT;
	} else if (PlayerUtils.consumeHeldItem(player, Items.gunpowder, 1)) {
		return Result.ALLOW;
	}
	PlayerUtils.sendTranslatedChat(player, "chat.zss.npc.barnes.hmph");
	return Result.DENY;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:10,代码来源:EntityNpcBarnes.java

示例14: canInteractConvert

@Override
public Result canInteractConvert(EntityPlayer player, EntityVillager villager) {
	if (villager.getClass() != EntityVillager.class || villager.isChild()) {
		return Result.DEFAULT;
	} else if (!villager.worldObj.isRemote) {
		checkShopStatus(player, true, false);
	}
	return Result.DENY;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:9,代码来源:EntityNpcMaskTrader.java

示例15: canInteractConvert

@Override
public Result canInteractConvert(EntityPlayer player, EntityVillager villager) {
	if (villager.getClass() != EntityVillager.class || villager.isChild()) {
		return Result.DEFAULT;
	}
	ZSSQuests quests = ZSSQuests.get(player);
	QuestZeldaTalk quest = (QuestZeldaTalk) quests.get(QuestZeldaTalk.class);
	if (quest == null) { // can be null if someone else converted the villager
		quest = new QuestZeldaTalk();
		quests.add(quest);
	}
	// Even though the held item is checked in #begin, it needs to be checked here as well
	ItemStack stack = player.getHeldItem();
	if (stack != null && stack.getItem() instanceof ItemInstrument && ((ItemInstrument) stack.getItem()).getInstrument(stack) == ItemInstrument.Instrument.OCARINA_FAIRY) {
		// allow if player already gave ocarina to Zelda, whether quest completed yet or not
		if (player.worldObj.isRemote) {
			ZSSPlayerSongs.get(player).preventSongGui = true; // prevent song GUI from opening when converting the Princess
			return Result.DENY;
		} else if (quest.hasBegun(player)) {
			conversionTime = -1; // skips quest intro, since player already went through it
			return Result.ALLOW;
		} else if (quest.begin(player)) {
			return Result.ALLOW;
		}
	}
	// If quest hasn't been completed, try to give a hint to the player
	if (!quest.isComplete(player)) {
		IChatComponent hint = quest.getHint(player);
		if (hint != null) {
			player.addChatMessage(hint);
			return Result.DENY;
		}
	}
	return Result.DEFAULT;
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:35,代码来源:EntityNpcZelda.java


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