本文整理汇总了Java中net.minecraft.block.BlockStandingSign类的典型用法代码示例。如果您正苦于以下问题:Java BlockStandingSign类的具体用法?Java BlockStandingSign怎么用?Java BlockStandingSign使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockStandingSign类属于net.minecraft.block包,在下文中一共展示了BlockStandingSign类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGen
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
ColossalBuilder doGen(Coord at, int randSeed) {
Coord signAt = at.copy();
ColossalBuilder builder = new ColossalBuilder(randSeed, at);
builder.construct();
if (signAt.getTE(TileEntityCommandBlock.class) != null) {
signAt.set(BlockStandingSign.ROTATION, 12, true);
TileEntitySign sign = signAt.getTE(TileEntitySign.class);
if (sign != null) {
sign.signText[0] = new ChatComponentText("Colossus Seed");
sign.signText[1] = new ChatComponentText("" + randSeed);
signAt.markBlockForUpdate();
}
}
return builder;
}
示例2: placeBanner
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
private void placeBanner(World worldIn, BlockPos pos, Side side) {
int rotation = Side.BLACK.equals(side) ? 0 : 8;
IBlockState banner = Blocks.STANDING_BANNER.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(rotation));
worldIn.setBlockState(pos, banner, 3);
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBanner) {
((TileEntityBanner) tileentity).setItemValues(createBannerItem(side), true);
}
}
示例3: onItemUse
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (side == EnumFacing.DOWN)
{
return false;
}
else if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid())
{
return false;
}
else
{
pos = pos.offset(side);
if (!playerIn.canPlayerEdit(pos, side, stack))
{
return false;
}
else if (!Blocks.standing_sign.canPlaceBlockAt(worldIn, pos))
{
return false;
}
else if (worldIn.isRemote)
{
return true;
}
else
{
if (side == EnumFacing.UP)
{
int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
worldIn.setBlockState(pos, Blocks.standing_sign.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
}
else
{
worldIn.setBlockState(pos, Blocks.wall_sign.getDefaultState().withProperty(BlockWallSign.FACING, side), 3);
}
--stack.stackSize;
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack))
{
playerIn.openEditSign((TileEntitySign)tileentity);
}
return true;
}
}
}
示例4: onItemUse
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ)
{
if (side == EnumFacing.DOWN)
{
return false;
}
else if (!worldIn.getBlockState(pos).getBlock().getMaterial().isSolid())
{
return false;
}
else
{
pos = pos.offset(side);
if (!playerIn.canPlayerEdit(pos, side, stack))
{
return false;
}
else if (!Blocks.standing_banner.canPlaceBlockAt(worldIn, pos))
{
return false;
}
else if (worldIn.isRemote)
{
return true;
}
else
{
if (side == EnumFacing.UP)
{
int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
worldIn.setBlockState(pos, Blocks.standing_banner.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
}
else
{
worldIn.setBlockState(pos, Blocks.wall_banner.getDefaultState().withProperty(BlockWallSign.FACING, side), 3);
}
--stack.stackSize;
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBanner)
{
((TileEntityBanner)tileentity).setItemValues(stack);
}
return true;
}
}
}
示例5: onItemUse
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
IBlockState iblockstate = playerIn.getBlockState(worldIn);
boolean flag = iblockstate.getBlock().isReplaceable(playerIn, worldIn);
if (hand != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || hand == EnumFacing.UP))
{
worldIn = worldIn.offset(hand);
ItemStack itemstack = stack.getHeldItem(pos);
if (stack.canPlayerEdit(worldIn, hand, itemstack) && Blocks.STANDING_SIGN.canPlaceBlockAt(playerIn, worldIn))
{
if (playerIn.isRemote)
{
return EnumActionResult.SUCCESS;
}
else
{
worldIn = flag ? worldIn.down() : worldIn;
if (hand == EnumFacing.UP)
{
int i = MathHelper.floor((double)((stack.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
playerIn.setBlockState(worldIn, Blocks.STANDING_SIGN.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 11);
}
else
{
playerIn.setBlockState(worldIn, Blocks.WALL_SIGN.getDefaultState().withProperty(BlockWallSign.FACING, hand), 11);
}
TileEntity tileentity = playerIn.getTileEntity(worldIn);
if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(playerIn, stack, worldIn, itemstack))
{
stack.openEditSign((TileEntitySign)tileentity);
}
itemstack.func_190918_g(1);
return EnumActionResult.SUCCESS;
}
}
else
{
return EnumActionResult.FAIL;
}
}
else
{
return EnumActionResult.FAIL;
}
}
示例6: onItemUse
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
IBlockState iblockstate = playerIn.getBlockState(worldIn);
boolean flag = iblockstate.getBlock().isReplaceable(playerIn, worldIn);
if (hand != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || hand == EnumFacing.UP))
{
worldIn = worldIn.offset(hand);
ItemStack itemstack = stack.getHeldItem(pos);
if (stack.canPlayerEdit(worldIn, hand, itemstack) && Blocks.STANDING_BANNER.canPlaceBlockAt(playerIn, worldIn))
{
if (playerIn.isRemote)
{
return EnumActionResult.SUCCESS;
}
else
{
worldIn = flag ? worldIn.down() : worldIn;
if (hand == EnumFacing.UP)
{
int i = MathHelper.floor((double)((stack.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
playerIn.setBlockState(worldIn, Blocks.STANDING_BANNER.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
}
else
{
playerIn.setBlockState(worldIn, Blocks.WALL_BANNER.getDefaultState().withProperty(BlockWallSign.FACING, hand), 3);
}
TileEntity tileentity = playerIn.getTileEntity(worldIn);
if (tileentity instanceof TileEntityBanner)
{
((TileEntityBanner)tileentity).setItemValues(itemstack, false);
}
itemstack.func_190918_g(1);
return EnumActionResult.SUCCESS;
}
}
else
{
return EnumActionResult.FAIL;
}
}
else
{
return EnumActionResult.FAIL;
}
}
示例7: onItemUse
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
boolean flag = iblockstate.getBlock().isReplaceable(worldIn, pos);
if (facing != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || facing == EnumFacing.UP))
{
pos = pos.offset(facing);
if (playerIn.canPlayerEdit(pos, facing, stack) && Blocks.STANDING_SIGN.canPlaceBlockAt(worldIn, pos))
{
if (worldIn.isRemote)
{
return EnumActionResult.SUCCESS;
}
else
{
pos = flag ? pos.down() : pos;
if (facing == EnumFacing.UP)
{
int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
worldIn.setBlockState(pos, Blocks.STANDING_SIGN.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 11);
}
else
{
worldIn.setBlockState(pos, Blocks.WALL_SIGN.getDefaultState().withProperty(BlockWallSign.FACING, facing), 11);
}
--stack.stackSize;
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntitySign && !ItemBlock.setTileEntityNBT(worldIn, playerIn, pos, stack))
{
playerIn.openEditSign((TileEntitySign)tileentity);
}
return EnumActionResult.SUCCESS;
}
}
else
{
return EnumActionResult.FAIL;
}
}
else
{
return EnumActionResult.FAIL;
}
}
示例8: onItemUse
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
/**
* Called when a Block is right-clicked with this Item
*/
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
IBlockState iblockstate = worldIn.getBlockState(pos);
boolean flag = iblockstate.getBlock().isReplaceable(worldIn, pos);
if (facing != EnumFacing.DOWN && (iblockstate.getMaterial().isSolid() || flag) && (!flag || facing == EnumFacing.UP))
{
pos = pos.offset(facing);
if (playerIn.canPlayerEdit(pos, facing, stack) && Blocks.STANDING_BANNER.canPlaceBlockAt(worldIn, pos))
{
if (worldIn.isRemote)
{
return EnumActionResult.SUCCESS;
}
else
{
pos = flag ? pos.down() : pos;
if (facing == EnumFacing.UP)
{
int i = MathHelper.floor_double((double)((playerIn.rotationYaw + 180.0F) * 16.0F / 360.0F) + 0.5D) & 15;
worldIn.setBlockState(pos, Blocks.STANDING_BANNER.getDefaultState().withProperty(BlockStandingSign.ROTATION, Integer.valueOf(i)), 3);
}
else
{
worldIn.setBlockState(pos, Blocks.WALL_BANNER.getDefaultState().withProperty(BlockWallSign.FACING, facing), 3);
}
--stack.stackSize;
TileEntity tileentity = worldIn.getTileEntity(pos);
if (tileentity instanceof TileEntityBanner)
{
((TileEntityBanner)tileentity).setItemValues(stack);
}
return EnumActionResult.SUCCESS;
}
}
else
{
return EnumActionResult.FAIL;
}
}
else
{
return EnumActionResult.FAIL;
}
}
示例9: CustomBlockProcessingHandled
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
@Override
protected Boolean CustomBlockProcessingHandled(StructureConfiguration configuration, BuildBlock block, World world, BlockPos originalPos,
EnumFacing assumedNorth, Block foundBlock, IBlockState blockState, EntityPlayer player)
{
HouseConfiguration houseConfig = (HouseConfiguration) configuration;
if ((!houseConfig.addBed && foundBlock instanceof BlockBed) || (!houseConfig.addChest && foundBlock instanceof BlockChest)
|| (!houseConfig.addTorches && foundBlock instanceof BlockTorch)
|| (!houseConfig.addCraftingTable && (foundBlock instanceof BlockWorkbench || foundBlock instanceof BlockFurnace)))
{
// Don't place the block, returning true means that this has been
// "handled"
return true;
}
if (foundBlock instanceof BlockFurnace)
{
this.furnacePosition = block.getStartingPosition().getRelativePosition(
originalPos,
this.getClearSpace().getShape().getDirection(),
configuration.houseFacing);
}
else if (foundBlock instanceof BlockTrapDoor && houseConfig.addMineShaft)
{
// The trap door will still be added, but the mine shaft may not be
// built.
this.trapDoorPosition = block.getStartingPosition().getRelativePosition(
originalPos,
this.getClearSpace().getShape().getDirection(),
configuration.houseFacing);
}
else if (foundBlock instanceof BlockChest && this.chestPosition == null)
{
this.chestPosition = block.getStartingPosition().getRelativePosition(
originalPos,
this.getClearSpace().getShape().getDirection(),
configuration.houseFacing);
}
else if (foundBlock instanceof BlockStandingSign)
{
this.signPosition = block.getStartingPosition().getRelativePosition(
originalPos,
this.getClearSpace().getShape().getDirection(),
configuration.houseFacing);
}
if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS.getRegistryName().getResourceDomain())
&& foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS.getRegistryName().getResourcePath()))
{
blockState = blockState.withProperty(BlockStainedGlass.COLOR, houseConfig.glassColor);
block.setBlockState(blockState);
this.priorityOneBlocks.add(block);
return true;
}
else if (foundBlock.getRegistryName().getResourceDomain().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourceDomain())
&& foundBlock.getRegistryName().getResourcePath().equals(Blocks.STAINED_GLASS_PANE.getRegistryName().getResourcePath()))
{
block.setBlockState(foundBlock.getStateFromMeta(houseConfig.glassColor.getMetadata()));
this.priorityOneBlocks.add(block);
return true;
}
return false;
}
示例10: setTombstone
import net.minecraft.block.BlockStandingSign; //导入依赖的package包/类
private void setTombstone() {
// Check for solid ground if no wall exists
boolean needsWall = !world.getBlockState(wallPos).getBlock().getMaterial().isSolid();
BlockPos groundPos = wallPos.down();
IBlockState groundState = world.getBlockState(groundPos);
boolean isSolidGround = groundState.getBlock().getMaterial().isSolid();
if (needsWall && !isSolidGround) {
return;
}
// Find and take one sign
boolean hasSign = false;
if (BaMsConfig.needSignToMakeSign || isCreative) {
for (int i = 0; i < inventory.getSizeInventory(); i++) {
ItemStack stack = inventory.getStackInSlot(i);
if (stack != null && stack.getItem() == Items.sign) {
inventory.decrStackSize(i, 1);
hasSign = true;
break;
}
}
} else {
hasSign = true;
}
// Place wall if needed
if (needsWall && !BaMsConfig.setTombstoneWall(world, wallPos, groundState, 2)) {
// Place standing sign if wall can't be placed
if (hasSign) {
int oppositeRotation = oppositeFacing.getHorizontalIndex() * 4;
BaMsConfig.setBlockState(world, wallPos, Blocks.standing_sign.getDefaultState().withProperty(BlockStandingSign.ROTATION, oppositeRotation), 2);
addSignEngraving(wallPos);
}
return;
}
// Place wall sign
if (hasSign) {
BaMsConfig.setBlockState(world, signPos, Blocks.wall_sign.getDefaultState().withProperty(BlockWallSign.FACING, oppositeFacing), 2);
addSignEngraving(signPos);
}
// Place flower pot
BaMsConfig.setFlowerPot(world, flowerPotPos, 2);
}