本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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));
}
}
示例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);
}
}
}
示例6: onInteract
import net.minecraftforge.event.entity.player.PlayerInteractEvent.RightClickBlock; //导入方法依赖的package包/类
@SubscribeEvent
public void onInteract(RightClickBlock event) {
lastInteractPos = event.getPos();
}