本文整理汇总了Java中net.minecraft.entity.player.EntityPlayer.isSneaking方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayer.isSneaking方法的具体用法?Java EntityPlayer.isSneaking怎么用?Java EntityPlayer.isSneaking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.entity.player.EntityPlayer
的用法示例。
在下文中一共展示了EntityPlayer.isSneaking方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: processInteract
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (!(player.getHeldItemMainhand() != null
&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
&& (this.getOwner() == player || this.getAttackTarget() == null || this.friendly) && this.isEntityAlive() && !this.isTrading()
&& !this.isChild() && !player.isSneaking()) {
if (this.world.isRemote && player.getTeam() == null
&& ((this.getCapability(TF2weapons.WEAPONS_CAP, null).state & 1) == 0 || this.friendly)
&& !player.isCreative())
ClientProxy.displayScreenConfirm("Choose a team to interact",
"Visit the Mann Co. Store located in a village");
if (!this.world.isRemote && (TF2Util.isOnSameTeam(this, player) || player.isCreative())
&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
this.setCustomer(player);
FMLNetworkHandler.openGui(player, TF2weapons.instance, 4, world, this.getEntityId(), 0, 0);
}
player.addStat(StatList.TALKED_TO_VILLAGER);
return true;
} else
return super.processInteract(player, hand);
}
示例2: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
EnumFacing facing, float hitX, float hitY, float hitZ)
{
if (!player.isSneaking())
{
if (world.isRemote)
{
return true;
}
TileEntity te = world.getTileEntity(pos);
if (!(te instanceof TileEntityInfusionAltar))
{
return false;
}
player.openGui(ArcaneMagic.instance, GUI_ID, world, pos.getX(), pos.getY(), pos.getZ());
return true;
}
return false;
}
示例3: processInteract
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
if (!(player.getHeldItemMainhand() != null
&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
&& this.getAttackTarget() == null && this.isEntityAlive() && !this.isTrading() && !this.isChild()
&& !player.isSneaking()) {
if (this.world.isRemote && player.getTeam() == null && !player.isCreative())
ClientProxy.displayScreenJoinTeam();
else if (!this.world.isRemote && (player.getTeam() != null || player.isCreative())
&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
this.setCustomer(player);
player.displayVillagerTradeGui(this);
}
player.addStat(StatList.TALKED_TO_VILLAGER);
return true;
} else
return super.processInteract(player, hand);
}
示例4: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (world.isRemote) { return stack; } // Not doing this on client side
if (this.getDamage(stack) >= this.getMaxDamage()) { return stack; } // Is empty
if (player.isSneaking()) // Dropping the magazine
{
this.dropMagazine(world, stack, player);
return stack;
}
if (this.getDamage(stack) >= this.getMaxDamage() - 7) { return stack; } // Doesn't have enough ammo in it)
this.doSingleFire(stack, world, player); // Handing it over to the neutral firing function
return stack;
}
示例5: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
//player.setItemInUse(stack, 60); // Let's try that on both sides...
if (world.isRemote) { return stack; } // Not doing this on client side
if (this.getDamage(stack) >= this.getMaxDamage()) { return stack; } // Is empty
if (player.isSneaking()) // Dropping the magazine
{
this.dropMagazine(world, stack, player);
return stack;
}
this.doSingleFire(stack, world, player); // Handing it over to the neutral firing function
return stack;
}
示例6: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos,
IBlockState state, EntityPlayer player, EnumFacing side, float hitX,
float hitY, float hitZ)
{
if (!world.isRemote){
if(player.isSneaking())
player.openGui(FundamentalChemistry.instance, ForgeGuiHandler.CHEMICAL_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
else
player.openGui(FundamentalChemistry.instance, ForgeGuiHandler.SIMPLE_MACHINE, world, pos.getX(), pos.getY(), pos.getZ());
}
return true;
}
示例7: onItemUseFirst
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
ItemStack stack = player.getHeldItem(hand);
if (!world.isRemote && stack.getMaxDamage() - stack.getItemDamage() >= 100) {
List<ISemiBlock> semiBlocks = SemiBlockManager.getInstance(world).getSemiBlocksAsList(world, pos);
if(semiBlocks.isEmpty()){
pos = pos.offset(side);
semiBlocks = SemiBlockManager.getInstance(world).getSemiBlocksAsList(world, pos);
}
if (!semiBlocks.isEmpty()) {
if (player.isSneaking()) {
semiBlocks.forEach(s -> SemiBlockManager.getInstance(world).breakSemiBlock(s, player));
return EnumActionResult.SUCCESS;
} else {
//TODO raytrace?
if (semiBlocks.stream().anyMatch(s -> s.onRightClickWithConfigurator(player))) {
addAir(stack, -PneumaticValues.USAGE_LOGISTICS_CONFIGURATOR);
return EnumActionResult.SUCCESS;
}
}
}
} else if (world.isRemote) {
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
示例8: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
// right-click air: clear any camo
ItemStack stack = playerIn.getHeldItem(handIn);
if (!worldIn.isRemote && playerIn.isSneaking() && getCamoState(stack) != null) {
setCamoState(stack, null);
}
return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
示例9: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float clickX, float clickY, float clickZ) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity == null || player.isSneaking()) {
return false;
}
player.openGui(OpenSensors.instance, 0, world, x, y, z);
return true;
}
示例10: rotateBlock
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean rotateBlock(World world, EntityPlayer player, BlockPos pos, EnumFacing side) {
if (player.isSneaking()) {
if (!player.capabilities.isCreativeMode) dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
world.setBlockToAir(pos);
return true;
} else {
if (isRotatable()) {
IBlockState state = world.getBlockState(pos);
if (!rotateCustom(world, pos, state, side)) {
if (rotateForgeWay()) {
if (!canRotateToTopOrBottom()) side = EnumFacing.UP;
if (getRotation(world, pos).getAxis() != side.getAxis()) {
setRotation(world, pos, getRotation(world, pos).rotateAround(side.getAxis()));
}
} else {
EnumFacing f = getRotation(world, pos);
do {
f = EnumFacing.getFront(f.ordinal() + 1);
} while (!canRotateToTopOrBottom() && f.getAxis() == Axis.Y);
setRotation(world, pos, f);
}
TileEntityBase te = (TileEntityBase) world.getTileEntity(pos);
if (te != null) te.onBlockRotated();
}
return true;
} else {
return false;
}
}
}
示例11: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (world.isRemote) { return stack; } // Not doing this on client side
if (stack.getItemDamage() == 0) { return stack; } // Already fully loaded
if (player.isSneaking())
{
this.fillEight(stack, world, player);
return stack;
}
// else, not sneaking, so just filling one
boolean doSFX = false;
if (player.inventory.hasItem(Items.redstone))
{
int dmg = stack.getItemDamage() - 1;
stack.setItemDamage(dmg);
player.inventory.consumeInventoryItem(Items.redstone); // We're just grabbing what we need from the inventory
// SFX
doSFX = true;
}
// else, doesn't have what it takes
if (doSFX) { world.playSoundAtEntity(player, "random.wood_click", 0.5F, 0.3F); }
return stack;
}
示例12: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (world.isRemote && player.getHeldItem(hand).isEmpty() && !player.isSneaking()) {
player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.APHORISM_TILE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
sendEditorMessage(player);
}
return true;
}
示例13: onBlockActivated
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
if (!world.isRemote) {
ItemStack held = player.getHeldItem(hand);
if (player.isSneaking()) {
if (state.getValue(FILTER) && ((TileDisplacer) world.getTileEntity(pos)).hasFilter()) {
state = state.withProperty(FILTER, false);
world.setBlockState(pos, state);
if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileDisplacer) {
((TileDisplacer) world.getTileEntity(pos)).setHasFilter(false);
((TileDisplacer) world.getTileEntity(pos)).markDirty();
PacketHandler.sendToAll(new PacketDisplacerSync(((TileDisplacer) world.getTileEntity(pos)), false));
if (!player.isCreative())
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(SimpleTubes.proxy.itemUpgrade, 1, 0));
}
}
return true;
} else {
if (!(held.getItem() instanceof ItemUpgrade) || held == ItemStack.EMPTY) {
if (((TileDisplacer) world.getTileEntity(pos)).hasFilter()) {
player.openGui(SimpleTubes.instance, 0, world, pos.getX(), pos.getY(), pos.getZ());
return true;
}
}
}
}
return true;
}
示例14: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
if (world.isRemote) { return stack; } // Not doing this on client side
if (this.getDamage(stack) >= this.getMaxDamage()) { return stack; } // Is empty
if (player.isSneaking()) // Dropping the magazine
{
this.dropMagazine(world, stack, player);
return stack;
}
this.doSingleFire(stack, world, player); // Handing it over to the neutral firing function
return stack;
}
示例15: onItemRightClick
import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
if (playerIn.isSneaking()) {
ItemStack stack = playerIn.getHeldItem(handIn);
if (!stack.hasTagCompound())
stack.setTagCompound(new NBTTagCompound());
stack.getTagCompound().setString("read_id", EntityPlayer.getUUID(playerIn.getGameProfile()).toString());
stack.getTagCompound().setString("read_name", playerIn.getDisplayNameString());
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
}
return super.onItemRightClick(worldIn, playerIn, handIn);
}