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


Java RightClickBlock.getPos方法代码示例

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


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

示例1: rightClick

import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
/** Makes portals if config. */
@SubscribeEvent
public void rightClick(RightClickBlock event) {

    EntityPlayer player = event.getEntityPlayer();
    World world = event.getWorld();
    ItemStack stack = event.getItemStack();
    Item item = stack.getItem();
    BlockPos pos = event.getPos();
    
    if (GeoConfig.compatibility.portals && item == GeoItems.FIREOPAL &&
            world instanceof WorldServer) {

        new Teleporter((WorldServer) world).makePortal(player);
        stack.shrink(1);
    }
    
    if (GeoConfig.compatibility.portals && item == GeoItems.AMETHYST) {
        
        Items.ENDER_EYE.onItemUse(player, world, pos,
                event.getHand(), event.getFace(), 0, 0, 0);
    }
}
 
开发者ID:JayAvery,项目名称:geomastery,代码行数:24,代码来源:BlockEvents.java

示例2: handleClickOnSnowable

import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
@SubscribeEvent(priority = EventPriority.HIGH)
public void handleClickOnSnowable(RightClickBlock e) {
  if (e.getItemStack() == null || e.getItemStack().getItem() != Item.getItemFromBlock(Blocks.SNOW_LAYER))
    return;
    
  BlockPos pos = e.getPos().up();
  BlockPos posUnder = e.getPos();
  
  boolean result = handleClick(pos, posUnder, e.getWorld());
  if (result)
    e.setCanceled(result);
}
 
开发者ID:Reoseah,项目名称:shifted-snow,代码行数:13,代码来源:ModEventHandler.java

示例3: handleClickOnSnow

import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
@SubscribeEvent
public void handleClickOnSnow(RightClickBlock e) {
  if (e.getItemStack() == null || e.getItemStack().getItem() != Item.getItemFromBlock(Blocks.SNOW_LAYER))
    return;
    
  BlockPos pos = e.getPos();
  BlockPos posUnder = e.getPos().down();
  
  boolean result = handleClick(pos, posUnder, e.getWorld());
  if (result)
    e.setCanceled(result);
}
 
开发者ID:Reoseah,项目名称:shifted-snow,代码行数:13,代码来源:ModEventHandler.java

示例4: interact

import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
@SubscribeEvent
public void interact(RightClickBlock event) {
    if(event.getSide() != Side.SERVER) return;

    World world = event.getWorld();
    BlockPos pos = event.getPos();

    IBlockState state = world.getBlockState(pos);
    if(state == null) return;
    if(!(state.getBlock() instanceof IRitualCore)) return;
    IRitualCore core = (IRitualCore)state.getBlock();
    pos = core.getRitualCorePosition(world, pos, state);
    if(!core.isRitualCore(world, pos, state)) return;

    ItemStack stack = event.getItemStack();
    if(stack == null) return;
    Item item = stack.getItem();
    if(item == Items.STICK) {

    } else if(item instanceof IWand) {

    } else {
        return;
    }

    event.setCanceled(true);
    event.setUseBlock(Result.DENY);

    List<EntityRitual> rituals = world.getEntitiesWithinAABB(EntityRitual.class, new AxisAlignedBB(pos));
    for(int i = 0; i < rituals.size(); i++) {
        RitualRecipeContainer c = rituals.get(i).getContainer();
        if(c != null && c.world == world && c.pos.equals(pos)) return; // There is already a ritual running here
    }

    IRitual ritual = findRitual(core, world, pos);
    if(ritual == null) return;

    Map<String, List<IInventory>> inventories = ritual.getInventories(core, world, pos);
    if(inventories.isEmpty()) return;
    HashBiMap<String, IRitualRecipe> recipes = RITUALS_RECIPES.get(ritual);
    IRitualRecipe recipe = findRitualRecipe(ritual, recipes.values(), inventories);
    if(recipe == null) return;

    int ticks = recipe.getDuration(ritual);
    if(ticks == -1) ticks = ritual.getDuration(recipe, core, world, pos);

    RitualRecipeContainer container = ritual.createContainer(recipe, core, world, pos, ticks, inventories, Side.SERVER);

    if(container != null) {
        world.spawnEntityInWorld(new EntityRitual(world, container));
    }
}
 
开发者ID:ExoMagica,项目名称:ExoMagica,代码行数:53,代码来源:RitualHandler.java

示例5: useFlintAndSteel

import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
@SubscribeEvent
public void useFlintAndSteel(RightClickBlock event) {
	if (event.getItemStack() == null || event.getItemStack().getItem() != Items.FLINT_AND_STEEL) {
		return;
	}

	BlockPos pos = event.getPos();

	int par4 = pos.getX();
	int par5 = pos.getY();
	int par6 = pos.getZ();

	int par7;

	if (event.getFace() == null) {
		par7 = 0;
	} else {
		par7 = event.getFace().getIndex();
	}

	if (par7 == 0) {
		par5--;
	}
	if (par7 == 1) {
		par5++;
	}
	if (par7 == 2) {
		par6--;
	}
	if (par7 == 3) {
		par6++;
	}
	if (par7 == 4) {
		par4--;
	}
	if (par7 == 5) {
		par4++;
	}

	Block i1 = getBlock(event.getWorld(), par4, par5, par6);
	if (i1 == Blocks.AIR) {
		boolean created = BlockTeletoryPortal.INSTANCE.trySpawnPortal(event.getWorld(), new BlockPos(par4, par5, par6));
		if (created) {
			event.setCanceled(true);
		}
	}
}
 
开发者ID:ToroCraft,项目名称:TeleToro,代码行数:48,代码来源:Teletory.java

示例6: onInteract

import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
@SubscribeEvent
public void onInteract(RightClickBlock event) {
    lastInteractPos = event.getPos();
}
 
开发者ID:d0sboots,项目名称:EnchantmentRevealer,代码行数:5,代码来源:Events.java


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