本文整理汇总了Java中net.minecraft.util.EnumFacing.DOWN属性的典型用法代码示例。如果您正苦于以下问题:Java EnumFacing.DOWN属性的具体用法?Java EnumFacing.DOWN怎么用?Java EnumFacing.DOWN使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类net.minecraft.util.EnumFacing
的用法示例。
在下文中一共展示了EnumFacing.DOWN属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onNeighborBlockUpdate
@Override
public void onNeighborBlockUpdate() {
super.onNeighborBlockUpdate();
EnumFacing oldSideConnected = sideConnected;
sideConnected = EnumFacing.DOWN;
for (EnumFacing d : EnumFacing.VALUES) {
BlockPos neighborPos = getPos().offset(d);
IBlockState state = getWorld().getBlockState(neighborPos);
if (state.isSideSolid(getWorld(), neighborPos, d.getOpposite())) {
sideConnected = d;
break;
}
}
if (sideConnected != oldSideConnected) {
sendDescriptionPacket();
}
}
示例2: getSurroundingPositions
private EnumFacing[] getSurroundingPositions() {
return new EnumFacing[] {
EnumFacing.NORTH,
EnumFacing.EAST,
EnumFacing.WEST,
EnumFacing.DOWN,
EnumFacing.UP,
EnumFacing.SOUTH
};
}
示例3: canExtractItem
/**
* Returns true if automation can extract the given item in the given slot
* from the given side.
*/
@Override
public boolean canExtractItem(int index, ItemStack stack, EnumFacing direction) {
if (direction == EnumFacing.DOWN && index == 9) {
Item item = stack.getItem();
if (item != Items.WATER_BUCKET && item != Items.BUCKET)
return false;
}
return true;
}
示例4: getCapability
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
if (!getStack().isEmpty() && capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY && facing == EnumFacing.DOWN) {
return CapabilityItemHandler.ITEM_HANDLER_CAPABILITY.cast(new SidedInvWrapper(this, facing));
}
return super.getCapability(capability, facing);
}
示例5: makePortalPair
public static void makePortalPair(World sourceWorld, BlockPos selectedBlock, EnumFacing selectedSide, TeleportDestination dest) {
BlockPos sourcePortalPos = findBestPosition(sourceWorld, selectedBlock, selectedSide);
if (sourcePortalPos == null) {
return;
}
World destWorld = mcjty.lib.varia.TeleportationTools.getWorldForDimension(dest.getDimension());
if (destWorld.getBlockState(dest.getPos()).getBlock() == ModBlocks.portalBlock) {
return;
}
if (dest.getSide() == EnumFacing.DOWN) {
if (!destWorld.isAirBlock(dest.getPos()) || !destWorld.isAirBlock(dest.getPos().down())) {
return;
}
} else {
if (!destWorld.isAirBlock(dest.getPos()) || !destWorld.isAirBlock(dest.getPos().up())) {
return;
}
}
sourceWorld.setBlockState(sourcePortalPos, ModBlocks.portalBlock.getDefaultState(), 3);
PortalTileEntity source = (PortalTileEntity) sourceWorld.getTileEntity(sourcePortalPos);
destWorld.setBlockState(dest.getPos(), ModBlocks.portalBlock.getDefaultState(), 3);
PortalTileEntity destination = (PortalTileEntity) destWorld.getTileEntity(dest.getPos());
source.setTimeout(Config.portalTimeout);
source.setOther(dest);
source.setPortalSide(selectedSide);
destination.setTimeout(Config.portalTimeout);
destination.setOther(new TeleportDestination("", sourceWorld.provider.getDimension(), sourcePortalPos, selectedSide));
destination.setPortalSide(dest.getSide());
}
示例6: onBlockPlaced
/**
* Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
* IBlockstate
*/
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
EnumFacing enumfacing = facing.getOpposite();
if (enumfacing == EnumFacing.UP)
{
enumfacing = EnumFacing.DOWN;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(ENABLED, Boolean.valueOf(true));
}
示例7: hasCapability
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
if(facing==EnumFacing.DOWN&&capability==FLUID){
return true;
}
return super.hasCapability(capability, facing);
}
示例8: renderModel
private void renderModel(EnumFacing facing, double x, double y, double z, float partialTicks) {
float tick = RenderHelper.getRenderWorldTime(partialTicks);
final float prevU = OpenGlHelper.lastBrightnessX;
final float prevV = OpenGlHelper.lastBrightnessY;
bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
//Top
GlStateManager.pushMatrix();
GlStateManager.translate(x + 0.5D, y + 0.5D, z + 0.5D);
if(facing != null && facing != EnumFacing.UP && facing != EnumFacing.DOWN) {
GlStateManager.rotate(90F, facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH ? 1F : 0F, 0F, facing == EnumFacing.EAST || facing == EnumFacing.WEST ? 1F : 0F);
}
GlStateManager.pushMatrix();
GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, 1F, 0F);
BlockBaker.render(BlockBaker.VACUUM_TOP);
GlStateManager.popMatrix();
//Middle
GlStateManager.disableLighting();
GLHelper.lightMap(255F, 255F);
BlockBaker.render(BlockBaker.VACUUM_PIECE);
GLHelper.lightMap(prevU, prevV);
GlStateManager.enableLighting();
//Bottom
GlStateManager.pushMatrix();
GlStateManager.rotate(partialTicks + tick * 0.5F % 360F, 0F, -1F, 0F);
BlockBaker.render(BlockBaker.VACUUM_BOTTOM);
GlStateManager.popMatrix();
GlStateManager.popMatrix();
}
示例9: getStateFromMeta
/**
* Convert the given metadata into a BlockState for this Block
*/
public IBlockState getStateFromMeta(int meta)
{
EnumFacing enumfacing;
switch (meta & 7)
{
case 0:
enumfacing = EnumFacing.DOWN;
break;
case 1:
enumfacing = EnumFacing.EAST;
break;
case 2:
enumfacing = EnumFacing.WEST;
break;
case 3:
enumfacing = EnumFacing.SOUTH;
break;
case 4:
enumfacing = EnumFacing.NORTH;
break;
case 5:
default:
enumfacing = EnumFacing.UP;
}
return this.getDefaultState().withProperty(FACING, enumfacing).withProperty(POWERED, Boolean.valueOf((meta & 8) > 0));
}
示例10: shouldSideBeRendered
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return side == EnumFacing.DOWN ? super.shouldSideBeRendered(blockState, blockAccess, pos, side) : true;
}
示例11: getSlotsForFace
@Override
public int[] getSlotsForFace(EnumFacing side) {
return side == EnumFacing.DOWN ? SLOTS_BOTTOM : (side == EnumFacing.UP ? SLOTS_TOP : SLOTS_SIDES);
}
示例12: getStrongPower
public int getStrongPower(IBlockAccess worldIn, BlockPos pos, IBlockState state, EnumFacing side)
{
return side == EnumFacing.DOWN ? this.getWeakPower(worldIn, pos, state, side) : 0;
}
示例13: func_181088_a
protected static boolean func_181088_a(World p_181088_0_, BlockPos p_181088_1_, EnumFacing p_181088_2_)
{
BlockPos blockpos = p_181088_1_.offset(p_181088_2_);
return p_181088_2_ == EnumFacing.DOWN ? World.doesBlockHaveSolidTopSurface(p_181088_0_, blockpos) : p_181088_0_.getBlockState(blockpos).getBlock().isNormalCube();
}
示例14: drawPipeConnectionAABB
private static void drawPipeConnectionAABB(BufferBuilder buffer, EnumFacing side, BlockPos pos) {
double minX = -0.0020000000949949026D + pos.getX(), minY = -0.0020000000949949026D + pos.getY(),
minZ = -0.0020000000949949026D + pos.getZ();
double maxX = 1.0020000000949949026D + pos.getX(), maxY = 1.0020000000949949026D + pos.getY(),
maxZ = 1.0020000000949949026D + pos.getZ();
if (side == null) {
minX = -0.0020000000949949026D + 0.3125 + pos.getX();
maxX = 1.0020000000949949026D - 0.3125 + pos.getX();
minY = -0.0020000000949949026D + 0.3125 + pos.getY();
maxY = 1.0020000000949949026D - 0.3125 + pos.getY();
minZ = -0.0020000000949949026D + 0.3125 + pos.getZ();
maxZ = 1.0020000000949949026D - 0.3125 + pos.getZ();
} else {
if (side.getAxis() != EnumFacing.Axis.X) {
minX = -0.0020000000949949026D + 0.3125 + pos.getX();
maxX = 1.0020000000949949026D - 0.3125 + pos.getX();
} else {
if (side == EnumFacing.WEST) {
maxX = -0.0020000000949949026D + 0.3125 + pos.getX();
} else if (side == EnumFacing.EAST) {
minX = 1.0020000000949949026D - 0.3125 + pos.getX();
}
}
if (side.getAxis() != EnumFacing.Axis.Y) {
minY = -0.0020000000949949026D + 0.3125 + pos.getY();
maxY = 1.0020000000949949026D - 0.3125 + pos.getY();
} else {
if (side == EnumFacing.DOWN) {
maxY = -0.0020000000949949026D + 0.3125 + pos.getY();
} else if (side == EnumFacing.UP) {
minY = 1.0020000000949949026D - 0.3125 + pos.getY();
}
}
if (side.getAxis() != EnumFacing.Axis.Z) {
minZ = -0.0020000000949949026D + 0.3125 + pos.getZ();
maxZ = 1.0020000000949949026D - 0.3125 + pos.getZ();
} else {
if (side == EnumFacing.NORTH) {
maxZ = -0.0020000000949949026D + 0.3125 + pos.getZ();
} else if (side == EnumFacing.SOUTH) {
minZ = 1.0020000000949949026D - 0.3125 + pos.getZ();
}
}
}
buffer.pos(minX, minY, minZ).color(0F, 0F, 0F, 0.0F).endVertex();
buffer.pos(minX, minY, maxZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(maxX, minY, maxZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(maxX, minY, minZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(minX, minY, minZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(minX, maxY, minZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(minX, minY, maxZ).color(0F, 0F, 0F, 0.0F).endVertex();
buffer.pos(minX, maxY, maxZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(maxX, minY, maxZ).color(0F, 0F, 0F, 0.0F).endVertex();
buffer.pos(maxX, maxY, maxZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(maxX, minY, minZ).color(0F, 0F, 0F, 0.0F).endVertex();
buffer.pos(maxX, maxY, minZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(minX, maxY, minZ).color(0F, 0F, 0F, 0.0F).endVertex();
buffer.pos(minX, maxY, maxZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(maxX, maxY, maxZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(maxX, maxY, minZ).color(0F, 0F, 0F, 0.4F).endVertex();
buffer.pos(minX, maxY, minZ).color(0F, 0F, 0F, 0.4F).endVertex();
}
示例15: onItemUse
/**
* 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
{
boolean flag = worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos);
BlockPos blockpos = flag ? pos : pos.offset(side);
if (!playerIn.canPlayerEdit(blockpos, side, stack))
{
return false;
}
else
{
BlockPos blockpos1 = blockpos.up();
boolean flag1 = !worldIn.isAirBlock(blockpos) && !worldIn.getBlockState(blockpos).getBlock().isReplaceable(worldIn, blockpos);
flag1 = flag1 | (!worldIn.isAirBlock(blockpos1) && !worldIn.getBlockState(blockpos1).getBlock().isReplaceable(worldIn, blockpos1));
if (flag1)
{
return false;
}
else
{
double d0 = (double)blockpos.getX();
double d1 = (double)blockpos.getY();
double d2 = (double)blockpos.getZ();
List<Entity> list = worldIn.getEntitiesWithinAABBExcludingEntity((Entity)null, AxisAlignedBB.fromBounds(d0, d1, d2, d0 + 1.0D, d1 + 2.0D, d2 + 1.0D));
if (list.size() > 0)
{
return false;
}
else
{
if (!worldIn.isRemote)
{
worldIn.setBlockToAir(blockpos);
worldIn.setBlockToAir(blockpos1);
EntityArmorStand entityarmorstand = new EntityArmorStand(worldIn, d0 + 0.5D, d1, d2 + 0.5D);
float f = (float)MathHelper.floor_float((MathHelper.wrapAngleTo180_float(playerIn.rotationYaw - 180.0F) + 22.5F) / 45.0F) * 45.0F;
entityarmorstand.setLocationAndAngles(d0 + 0.5D, d1, d2 + 0.5D, f, 0.0F);
this.applyRandomRotations(entityarmorstand, worldIn.rand);
NBTTagCompound nbttagcompound = stack.getTagCompound();
if (nbttagcompound != null && nbttagcompound.hasKey("EntityTag", 10))
{
NBTTagCompound nbttagcompound1 = new NBTTagCompound();
entityarmorstand.writeToNBTOptional(nbttagcompound1);
nbttagcompound1.merge(nbttagcompound.getCompoundTag("EntityTag"));
entityarmorstand.readFromNBT(nbttagcompound1);
}
worldIn.spawnEntityInWorld(entityarmorstand);
}
--stack.stackSize;
return true;
}
}
}
}
}