本文整理匯總了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;
}
示例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]);
}
}
}
示例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]);
}
}
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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);
}
示例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]);
}
}
}
示例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);
}
}
}
示例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);
}
}
示例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;
}
示例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;
}
示例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;
}