本文整理了Java中net.minecraft.block.Block.rotateBlock()
方法的一些代码示例,展示了Block.rotateBlock()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Block.rotateBlock()
方法的具体详情如下:
包路径:net.minecraft.block.Block
类名称:Block
方法名:rotateBlock
暂无
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public EnumActionResult onItemUseFirst( final EntityPlayer player, final World world, final BlockPos pos, final EnumFacing side, final float hitX, final float hitY, final float hitZ, final EnumHand hand )
{
final Block b = world.getBlockState( pos ).getBlock();
if( b != null && !player.isSneaking() && Platform.hasPermissions( new DimensionalCoord( world, pos ), player ) )
{
if( Platform.isClient() )
{
// TODO 1.10-R - if we return FAIL on client, action will not be sent to server. Fix that in all
// Block#onItemUseFirst overrides.
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
}
if( b.rotateBlock( world, pos, side ) )
{
player.swingArm( hand );
return !world.isRemote ? EnumActionResult.SUCCESS : EnumActionResult.FAIL;
}
}
return EnumActionResult.PASS;
}
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
@Override
public boolean rotateBlock( final World w, final BlockPos pos, final EnumFacing axis )
{
final IOrientable rotatable = this.getOrientable( w, pos );
if( rotatable != null && rotatable.canBeRotated() )
{
if( this.hasCustomRotation() )
{
this.customRotateBlock( rotatable, axis );
return true;
}
else
{
EnumFacing forward = rotatable.getForward();
EnumFacing up = rotatable.getUp();
for( int rs = 0; rs < 4; rs++ )
{
forward = Platform.rotateAround( forward, axis );
up = Platform.rotateAround( up, axis );
if( this.isValidOrientation( w, pos, forward, up ) )
{
rotatable.setOrientation( forward, up );
return true;
}
}
}
}
return super.rotateBlock( w, pos, axis );
}
代码示例来源:origin: Vazkii/Botania
&& block.rotateBlock(world, pos, side)) {
player.swingArm(hand);
return EnumActionResult.SUCCESS;
代码示例来源:origin: AppliedEnergistics/Applied-Energistics-2
if( !( te instanceof IGridHost ) )
if( b.rotateBlock( w, pos, side ) )
代码示例来源:origin: ForestryMC/ForestryMC
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
Block block = worldIn.getBlockState(pos).getBlock();
if (block.rotateBlock(worldIn, pos, facing)) {
player.swingArm(hand);
return EnumActionResult.SUCCESS;
}
return EnumActionResult.FAIL;
}
代码示例来源:origin: CyclopsMC/IntegratedDynamics
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side,
float hitX, float hitY, float hitZ, EnumHand hand) {
Block block = world.getBlockState(pos).getBlock();
if(!world.isRemote || player.isSneaking()) {
return EnumActionResult.PASS;
} else if(block.rotateBlock(world, pos, side)) {
player.swingArm(hand);
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
代码示例来源:origin: GregTechCE/GregTech
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
if (!world.isRemote && !world.isAirBlock(pos)) {
ItemStack stack = player.getHeldItem(hand);
TileEntity tileEntity = world.getTileEntity(pos);
if(tileEntity instanceof MetaTileEntityHolder)
//machines handle wrench click manually
return EnumActionResult.PASS;
if (world.getBlockState(pos).getBlock().rotateBlock(world, pos, side)) {
GTUtility.doDamageItem(stack, this.cost, false);
}
return EnumActionResult.SUCCESS;
}
return EnumActionResult.PASS;
}
代码示例来源:origin: SleepyTrousers/EnderIO
if (!player.isSneaking() && block.rotateBlock(world, pos, side)) {
ret = true;
} else if (block instanceof IBlockPaintableBlock && !player.isSneaking() && !YetaUtil.shouldHeldItemHideFacades(player)) {
代码示例来源:origin: PrinceOfAmber/Cyclic
boolean isDone = clickedBlock.rotateBlock(worldObj, pos, side);
if (isDone) {
代码示例来源:origin: P3pp3rF1y/AncientWarfare2
if (!world.isAirBlock(hit.getBlockPos())) {
IBlockState state = world.getBlockState(hit.getBlockPos());
if (state.getBlock().rotateBlock(world, hit.getBlockPos(), hit.sideHit))
playSound(world, hit, SoundEvents.BLOCK_PISTON_EXTEND);
else
代码示例来源:origin: AlgorithmX2/Chisels-and-Bits
if ( b.getBlock().rotateBlock( world, pos, side ) )
代码示例来源:origin: MatterOverdrive/MatterOverdrive-Legacy-Edition
@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);
IBlockState state = world.getBlockState(pos);
EnumActionResult result = EnumActionResult.PASS;
if (!state.getBlock().isAir(state, world, pos)) {
PlayerInteractEvent e = new PlayerInteractEvent.RightClickBlock(player, hand, pos, side, new Vec3d(hitX, hitY, hitZ));
if (MinecraftForge.EVENT_BUS.post(e) || e.getResult() == Event.Result.DENY) {
return EnumActionResult.FAIL;
}
if (player.isSneaking() && state.getBlock() instanceof IDismantleable && ((IDismantleable) state.getBlock()).canDismantle(player, world, pos)) {
if (!world.isRemote) {
((IDismantleable) state.getBlock()).dismantleBlock(player, world, pos, false);
}
result = EnumActionResult.SUCCESS;
}
if (state.getBlock() instanceof IWrenchable && !world.isRemote) {
result = ((IWrenchable) state.getBlock()).onWrenchHit(stack, player, world, pos, side, hitX, hitY, hitZ) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
} else if (!player.isSneaking() && state.getBlock().rotateBlock(world, pos, side)) {
result = EnumActionResult.SUCCESS;
}
}
if (result == EnumActionResult.SUCCESS)
player.swingArm(hand);
return result;
}
代码示例来源:origin: CoFH/ThermalFoundation
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
IBlockState state = world.getBlockState(pos);
Block block = state.getBlock();
if (world.isAirBlock(pos)) {
return EnumActionResult.PASS;
}
PlayerInteractEvent.RightClickBlock event = new PlayerInteractEvent.RightClickBlock(player, hand, pos, side, new Vec3d(hitX, hitY, hitZ));
if (MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Result.DENY || event.getUseBlock() == Result.DENY || event.getUseItem() == Result.DENY) {
return EnumActionResult.PASS;
}
if (ServerHelper.isServerWorld(world) && player.isSneaking() && block instanceof IDismantleable && ((IDismantleable) block).canDismantle(world, pos, state, player)) {
((IDismantleable) block).dismantleBlock(world, pos, state, player, false);
return EnumActionResult.SUCCESS;
}
if (BlockHelper.canRotate(block)) {
world.setBlockState(pos, BlockHelper.rotateVanillaBlock(world, state, pos), 3);
player.swingArm(hand);
return ServerHelper.isServerWorld(world) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
} else if (!player.isSneaking() && block.rotateBlock(world, pos, side)) {
player.swingArm(hand);
return ServerHelper.isServerWorld(world) ? EnumActionResult.SUCCESS : EnumActionResult.PASS;
}
return EnumActionResult.PASS;
}
代码示例来源:origin: CoFH/RedstoneArsenal
} else if (!player.isSneaking() && block.rotateBlock(world, pos, side)) {
if (!player.capabilities.isCreativeMode) {
useEnergy(stack, false);
代码示例来源:origin: CoFH/RedstoneArsenal
} else if (!player.isSneaking() && block.rotateBlock(world, pos, side)) {
if (!player.capabilities.isCreativeMode) {
useEnergy(stack, false);
代码示例来源:origin: raoulvdberge/refinedstorage
block.rotateBlock(world, pos, player.getHorizontalFacing().getOpposite());
内容来源于网络,如有侵权,请联系作者删除!