本文整理匯總了Java中net.minecraft.block.BlockHorizontal類的典型用法代碼示例。如果您正苦於以下問題:Java BlockHorizontal類的具體用法?Java BlockHorizontal怎麽用?Java BlockHorizontal使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlockHorizontal類屬於net.minecraft.block包,在下文中一共展示了BlockHorizontal類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getBedOrientationInDegrees
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
/**
* Returns the orientation of the bed in degrees.
*/
public float getBedOrientationInDegrees()
{
if (this.bedLocation != null)
{
EnumFacing enumfacing = (EnumFacing)this.world.getBlockState(this.bedLocation).getValue(BlockHorizontal.FACING);
switch (enumfacing)
{
case SOUTH:
return 90.0F;
case WEST:
return 0.0F;
case NORTH:
return 270.0F;
case EAST:
return 180.0F;
}
}
return 0.0F;
}
示例2: StructureBlock
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
public StructureBlock(boolean canMirror)
{
super(Material.PISTON);
this.canMirror = canMirror;
setSoundType(SoundType.STONE);
setHardness(0.5f);
IBlockState defaultState = this.blockState
.getBaseState()
.withProperty(BlockHorizontal.FACING, EnumFacing.NORTH);
if (canMirror)
{
defaultState = defaultState.withProperty(MIRROR, false);
}
setDefaultState(defaultState);
}
示例3: StructureShapeBlock
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
public StructureShapeBlock()
{
super(Material.PISTON);
setSoundType(SoundType.STONE);
setHardness(0.5f);
setUnlocalizedName(NAME);
IBlockState state = this.blockState.getBaseState().withProperty(BlockHorizontal.FACING, EnumFacing.NORTH);
if (canMirror())
{
state = state.withProperty(MIRROR, false);
}
setDefaultState(state);
}
示例4: addCollisionBoxToList
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
@Deprecated
public void addCollisionBoxToList(IBlockState state, World world, BlockPos pos, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity collidingEntity)
{
final IStructureTE te = (IStructureTE) world.getTileEntity(pos);
if (te != null)
{
final BlockPos mloc = te.getMasterBlockLocation();
final StructureBlock sb = StructureRegistry.getStructureBlock(te.getRegHash());
if (sb == null || sb.getPattern().getCollisionBoxes() == null)
{
return;
}
localToGlobalCollisionBoxes(mloc.getX(), mloc.getY(), mloc.getZ(),
mask, list, sb.getPattern().getCollisionBoxes(),
state.getValue(BlockHorizontal.FACING), getMirror(state),
sb.getPattern().getBlockBounds()
);
}
}
示例5: getMasterBlockLocation
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
public BlockPos getMasterBlockLocation()
{
if (!masterLocation.isPresent())
{
final IBlockState state = getWorld().getBlockState(pos);
final StructureBlock sb = StructureRegistry.getStructureBlock(definitionHash);
if (sb == null)
{
return pos;
}
masterLocation = Optional.of(localToGlobal(
-local.getX(), -local.getY(), -local.getZ(),
pos.getX(), pos.getY(), pos.getZ(),
state.getValue(BlockHorizontal.FACING), getMirror(state),
sb.getPattern().getBlockBounds()));
}
return masterLocation.get();
}
示例6: getRenderBoundingBox
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox()
{
if (!renderBounds.isPresent())
{
final StructureBlock sb = getMasterBlockInstance();
if (sb == null)
{
return INFINITE_EXTENT_AABB;
}
final IBlockState state = getWorld().getBlockState(pos);
final EnumFacing orientation = state.getValue(BlockHorizontal.FACING);
final boolean mirror = StructureBlock.getMirror(state);
renderBounds = Optional.of(localToGlobalBoundingBox(pos, local, sb.getPattern(), orientation, mirror));
}
return renderBounds.get();
}
示例7: getTransmutedBlock
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
default IBlockState getTransmutedBlock()
{
final StructureBlock sb = StructureRegistry.getStructureBlock(getRegHash());
if (sb != null)
{
final IBlockState state = getWorld().getBlockState(getPos());
if (state != null && state.getBlock() instanceof IStructureTE)
{
final IBlockState block = sb.getPattern().getBlock(getLocal()).getBlockState();
return block == null ?
Blocks.AIR.getDefaultState() :
localToGlobal(
block,
state.getValue(BlockHorizontal.FACING),
getMirror(state)
);
}
}
return Blocks.AIR.getDefaultState();
}
示例8: renderShelf
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
public void renderShelf(TileEntityDisplay te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
EnumFacing facing = te.getWorld().getBlockState(te.getPos()).getValue(BlockHorizontal.FACING);
for (int i = 0; i < 4; ++i) {
if (!te.getStackInSlot(i).isEmpty()) {
EntityItem customItem = new EntityItem(te.getWorld());
customItem.hoverStart = 0.0F;
customItem.setItem(te.getStackInSlot(i));
GlStateManager.pushMatrix();
GlStateManager.translate((float) x, (float) y, (float) z);
if (facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH) {
if (i < 2) {
GlStateManager.translate(0.25F + (0.5F * i), 0.5F, 0.5F);
} else {
GlStateManager.translate(0.25F + (0.5F * (i - 2)), 0F, 0.5F);
}
} else {
if (i < 2) {
GlStateManager.translate(0.5F, 0.5F, 0.75F - (0.5F * i));
} else {
GlStateManager.translate(0.5F, 0F, 0.75F - (0.5F * (i - 2)));
}
}
if (ConfigHandler.laidDownShelves && !(te.getStackInSlot(i).getItem() instanceof ItemBlock)) {
GlStateManager.rotate(-90, 1, 0, 0);
GlStateManager.translate(0, -0.25, 0.075);
}
GlStateManager.rotate(90 * facing.getOpposite().getHorizontalIndex(), 0.0F, 1.0F, 0.0F);
GlStateManager.scale(0.7F, 0.7F, 0.7F);
itemRender.doRender(customItem, 0, 0, 0, 0, 0);
GlStateManager.popMatrix();
}
}
}
示例9: onLivingUpdate
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
public void onLivingUpdate()
{
// ensure that jumpkins spawn aligned as blocks (TODO - doesn't work)
if (this.firstUpdate)
{
this.alignToBlocks();
}
if (!this.world.isRemote)
{
// if it's daytime, jumpkins have a chance to turn into pumpkins
if (ModConfiguration.jumpkinsDespawnDuringDaytime && this.world.isDaytime())
{
float brightness = this.getBrightness();
if (brightness > 0.5F && this.world.canBlockSeeSky(this.getPosition()) && ((this.rand.nextFloat() * 30F) < ((brightness - 0.4F) * 2.0F)))
{
// but only if the config says so, and mobGriefing is turned on, and they're on the ground or in water
if (ModConfiguration.jumpkinsTurnToPumpkins && this.world.getGameRules().getBoolean("mobGriefing") && (this.onGround || this.isInWater()))
{
IBlockState state = Blocks.PUMPKIN.getDefaultState().withProperty(BlockHorizontal.FACING, this.getHorizontalFacing());
this.world.setBlockState(this.getPosition(), state);
}
this.setDead();
this.spawnExplosionParticle();
}
}
}
super.onLivingUpdate();
}
示例10: createBlockState
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
protected BlockStateContainer createBlockState()
{
if (canMirror)
{
return new BlockStateContainer(this, BlockHorizontal.FACING, MIRROR);
}
return new BlockStateContainer(this, BlockHorizontal.FACING);
}
示例11: getStateFromMeta
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
@Deprecated
public IBlockState getStateFromMeta(int meta)
{
final EnumFacing facing = EnumFacing.getHorizontal(meta & 0x3);
IBlockState state = getDefaultState().withProperty(BlockHorizontal.FACING, facing);
if (canMirror)
{
state = state.withProperty(MIRROR, (meta & 0x4) != 0);
}
return state;
}
示例12: getMetaFromState
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
public int getMetaFromState(IBlockState state)
{
final EnumFacing facing = state.getValue(BlockHorizontal.FACING);
final boolean mirror = getMirror(state);
if (canMirror)
{
return facing.getHorizontalIndex() | (mirror ? 1 << 2 : 0);
} else
{
return facing.getHorizontalIndex();
}
}
示例13: onBlockPlacedBy
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
super.onBlockPlacedBy(world, pos, state, placer, stack);
final EnumFacing orientation = state.getValue(BlockHorizontal.FACING);
final boolean mirror = getMirror(state);
formStructure(world, pos, state, 0x2);
updateExternalNeighbours(world, pos, getPattern(), orientation, mirror, false);
}
示例14: addCollisionBoxToList
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
@Deprecated
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB mask, List<AxisAlignedBB> list, Entity entityIn)
{
if (getPattern().getCollisionBoxes() != null)
{
localToGlobalCollisionBoxes(
pos.getX(), pos.getY(), pos.getZ(),
mask, list, getPattern().getCollisionBoxes(),
state.getValue(BlockHorizontal.FACING), getMirror(state),
getPattern().getBlockBounds()
);
}
}
示例15: createBlockState
import net.minecraft.block.BlockHorizontal; //導入依賴的package包/類
@Override
protected BlockStateContainer createBlockState()
{
if (canMirror())
{
return new BlockStateContainer(this, BlockHorizontal.FACING, MIRROR);
}
return new BlockStateContainer(this, BlockHorizontal.FACING);
}