本文整理汇总了Java中net.minecraft.block.BlockAir类的典型用法代码示例。如果您正苦于以下问题:Java BlockAir类的具体用法?Java BlockAir怎么用?Java BlockAir使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
BlockAir类属于net.minecraft.block包,在下文中一共展示了BlockAir类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getTarget
import net.minecraft.block.BlockAir; //导入依赖的package包/类
public BlockData getTarget(BlockPos pos) {
EnumFacing[] orderedFacingValues = new EnumFacing[] {
EnumFacing.UP,
EnumFacing.EAST,
EnumFacing.NORTH,
EnumFacing.WEST,
EnumFacing.SOUTH,
EnumFacing.DOWN
};
for (EnumFacing facing : orderedFacingValues) {
BlockPos alteredPos = pos.add(facing.getOpposite().getDirectionVec());
if (!mc.theWorld.getBlockState(alteredPos).getBlock().isReplaceable(mc.theWorld, alteredPos) && !(mc.theWorld.getBlockState(alteredPos).getBlock() instanceof BlockLiquid) && !(mc.theWorld.getBlockState(alteredPos).getBlock() instanceof BlockAir)) {
return new BlockData(alteredPos, facing);
}
}
return null;
}
示例2: isTouchingLiquid
import net.minecraft.block.BlockAir; //导入依赖的package包/类
public static boolean isTouchingLiquid() {
Minecraft mc = Minecraft.getMinecraft();
boolean inLiquid = false;
int y = (int) mc.player.boundingBox.minY;
for (int x = floor_double(mc.player.boundingBox.minX); x < floor_double(mc.player.boundingBox.maxX) + 1; x++) {
for (int z = floor_double(mc.player.boundingBox.minZ); z < floor_double(mc.player.boundingBox.maxZ)
+ 1; z++) {
net.minecraft.block.Block block = mc.world.getBlockState(new BlockPos(x, y, z)).getBlock();
if ((block != null) && (!(block instanceof BlockAir))) {
if (!(block instanceof BlockLiquid)) {
return false;
}
inLiquid = true;
}
}
}
return inLiquid;
}
示例3: renderTileEntityAt
import net.minecraft.block.BlockAir; //导入依赖的package包/类
@Override
public void renderTileEntityAt(TileEntity t, double x, double y, double z, float f, int i) {
TileEntity_Railing tile = (TileEntity_Railing) t;
if (!tile.isInvalid()) {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5, y-1, z + 0.5);
bindTexture(texture);
Block right = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(1,-1,0))).getBlock();
Block left = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(-1,0,0))).getBlock();
Block front = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(0,0,1))).getBlock();
Block back = tile.getWorld().getBlockState(tile.getPos().add(new Vec3i(0,0,-1))).getBlock();
if(!(left instanceof BlockAir)&&!(left instanceof Block_Railing)){
model.renderPart("left");
}else
if(!(right instanceof BlockAir)&&!(right instanceof Block_Railing)){
model.renderPart("right");
}else
model.renderPart("middle");
GL11.glPopMatrix();
}
}
示例4: parseObject
import net.minecraft.block.BlockAir; //导入依赖的package包/类
@Override
public Object parseObject(String input) {
Object[] objects = StringUtils.StringToObjects(input);
if(objects.length == 4 && objects[0] instanceof String && objects[1] instanceof Integer && objects[2] instanceof Integer && (objects[3] instanceof NBTTagCompound || objects[3] instanceof String))
{
ItemStack stack = null;
if(Item.itemRegistry.getObject((String)objects[0]) != null)
stack = new ItemStack((Item)Item.itemRegistry.getObject((String)objects[0]));
else if(!(Block.blockRegistry.getObject((String)objects[0]) instanceof BlockAir))
stack = new ItemStack((Block)Block.blockRegistry.getObject((String)objects[0]));
else
return null;
stack.stackSize = (Integer)objects[1];
stack.setItemDamage((Integer)objects[2]);
if(objects[3] instanceof NBTTagCompound)
stack.stackTagCompound = (NBTTagCompound)objects[3];
return stack;
}
return null;
}
示例5: ItemInfo
import net.minecraft.block.BlockAir; //导入依赖的package包/类
public ItemInfo(ItemStack stack, boolean needDamage, boolean needNBT)
{
if(stack == null)
this.item = "";
else
{
if(Block.getBlockFromItem(stack.getItem()) instanceof BlockAir)
this.item = Item.itemRegistry.getNameForObject(stack.getItem());
else
this.item = Block.blockRegistry.getNameForObject(Block.getBlockFromItem(stack.getItem()));
}
if(needDamage)
this.damage = stack.getItemDamage();
else
this.damage = -1;
if(needNBT)
this.nbt = stack.stackTagCompound;
else
this.nbt = null;
this.ore = "";
}
示例6: CheckBlock
import net.minecraft.block.BlockAir; //导入依赖的package包/类
private static boolean CheckBlock(World world, BlockPos blockPos, boolean forceAir) {
IBlockState blockState = world.getBlockState(blockPos);
if (blockState == null)
return true;
// Check to make sure it is an air block, or replaceable...
if ((blockState.getBlock() instanceof BlockAir && forceAir) || (blockState.getBlock().isReplaceable(world, blockPos) && forceAir))
return true;
else if (forceAir)
return false;
// Check to make sure it is not an Tile Entity
if (blockState.getBlock().hasTileEntity(blockState))
return false;
// Make sure the block isn't unbreakable
if (blockState.getBlock().getBlockHardness(world.getBlockState(blockPos), world, blockPos) == -1.0F) {
return false;
}
// Make sure the block is on the whitelist
//return BreakableWhiteListHelper.checkBlock(blockState);
return false;
}
示例7: canSeeAbove
import net.minecraft.block.BlockAir; //导入依赖的package包/类
/**
* Method used to detect if a block is above this block (blocking our sunlight).
*
* @param world world object.
* @param blockPos Block position.
*/
public boolean canSeeAbove(World world, BlockPos blockPos) {
boolean clear = true;
if (!world.isRemote) {
for (int yy = blockPos.getY() + 1; yy < 255; yy++) {
// Block b = world.getBlock(x, yy, z);
Block b = BlockUtils.getBlock(world, blockPos.getX(), yy, blockPos.getZ()).getBlock();
if (b != null && !(b instanceof BlockAir)) {
clear = false;
break;
}
}
}
return clear;
}
示例8: readFromNBT
import net.minecraft.block.BlockAir; //导入依赖的package包/类
@Override
public void readFromNBT(NBTTagCompound nbt)
{
super.readFromNBT(nbt);
for (int i = 0; i < connection.length; i++) {
connection[i] = nbt.getBoolean("connect" + i);
}
String name = nbt.getString("block");
if(!name.equals(""))
{
block = Block.getBlockFromName(name);
if(block instanceof BlockAir)
block = null;
meta = nbt.getInteger("meta");
}
}
示例9: onDataPacket
import net.minecraft.block.BlockAir; //导入依赖的package包/类
@Override
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt)
{
super.onDataPacket(net, pkt);
transmitedPower = pkt.func_148857_g().getInteger("transpower");
for (int i = 0; i < connection.length; i++) {
connection[i] = pkt.func_148857_g().getBoolean("connect" + i);
}
String name = pkt.func_148857_g().getString("block");
if(!name.equals(""))
{
block = Block.getBlockFromName(name);
if(block instanceof BlockAir)
block = null;
meta = pkt.func_148857_g().getInteger("meta");
}
worldObj.markBlockRangeForRenderUpdate(xCoord, yCoord, zCoord, xCoord, yCoord, zCoord);
}
示例10: registerBlocks
import net.minecraft.block.BlockAir; //导入依赖的package包/类
@Override
public void registerBlocks() {
SubBlockRF ra = registerBlock(new SubBlockRF("RAtoRF", this, true));
SubBlockRF rf = registerBlock(new SubBlockRF("RFtoRA", this, false));
Block block = (Block) Block.blockRegistry.getObject("ThermalExpansion:Cell");
if(block == null && block instanceof BlockAir)
block = Blocks.redstone_block;
GameRegistry.addRecipe(new ShapedOreRecipe(rf.getItemStack(), new Object[]
{
"IBI", "IRI", "IAI", Character.valueOf('I'), "ingotIron", Character.valueOf('R'), Blocks.redstone_block, Character.valueOf('A'), SubSystemBattery.instance.getBattery(2), Character.valueOf('B'), new ItemStack(block, 1, 1)
}));
GameRegistry.addRecipe(new ShapedOreRecipe(ra.getItemStack(), new Object[]
{
"IAI", "IRI", "IBI", Character.valueOf('I'), "ingotIron", Character.valueOf('R'), Blocks.redstone_block, Character.valueOf('A'), SubSystemBattery.instance.getBattery(2), Character.valueOf('B'), new ItemStack(block, 1, 1)
}));
}
示例11: ItemBlockPneumaticCraft
import net.minecraft.block.BlockAir; //导入依赖的package包/类
public ItemBlockPneumaticCraft(Block block) {
super(block);
if (block instanceof BlockPneumaticCraft) {
this.block = (BlockPneumaticCraft) block;
} else {
if (!(block instanceof BlockAir) && !(block instanceof BlockFluidBase)) {
Log.warning("Block " + block.getUnlocalizedName() + " does not extend BlockPneumaticCraft! No tooltip displayed");
}
}
}
示例12: isOnLiquid
import net.minecraft.block.BlockAir; //导入依赖的package包/类
public static boolean isOnLiquid() {
AxisAlignedBB par1AxisAlignedBB = Minecraft.getMinecraft().thePlayer.boundingBox.offset(0.0, -0.01, 0.0).contract(0.001, 0.001, 0.001);
int var4 = MathHelper.floor_double((double)par1AxisAlignedBB.minX);
int var5 = MathHelper.floor_double((double)(par1AxisAlignedBB.maxX + 1.0));
int var6 = MathHelper.floor_double((double)par1AxisAlignedBB.minY);
int var7 = MathHelper.floor_double((double)(par1AxisAlignedBB.maxY + 1.0));
int var8 = MathHelper.floor_double((double)par1AxisAlignedBB.minZ);
int var9 = MathHelper.floor_double((double)(par1AxisAlignedBB.maxZ + 1.0));
Vec3 var11 = new Vec3(0.0, 0.0, 0.0);
int var12 = var4;
while (var12 < var5) {
int var13 = var6;
while (var13 < var7) {
int var14 = var8;
while (var14 < var9) {
Block var15 = Minecraft.getMinecraft().theWorld.getBlockState(new BlockPos(var12, var13, var14)).getBlock();
if (!(var15 instanceof BlockAir) && !(var15 instanceof BlockLiquid)) {
return false;
}
++var14;
}
++var13;
}
++var12;
}
return true;
}
示例13: ParseBlockType
import net.minecraft.block.BlockAir; //导入依赖的package包/类
/**
* Attempts to parse the block type string.
* @param s The string to parse.
* @return The block type, or null if the string is not recognised.
*/
public static IBlockState ParseBlockType( String s )
{
if( s == null )
return null;
Block block = (Block)Block.blockRegistry.getObject(new ResourceLocation( s ));
if( block instanceof BlockAir && !s.equals("air") ) // Minecraft returns BlockAir when it doesn't recognise the string
return null; // unrecognised string
return block.getDefaultState();
}
示例14: springEffect
import net.minecraft.block.BlockAir; //导入依赖的package包/类
private void springEffect()
{
BlockPos pos = this.getPosition();
IBlockState state = this.world.getBlockState(pos.down());
if (!(state.getBlock() instanceof BlockAir))
{
try
{
SoundType soundType = state.getBlock().getSoundType(state, this.world, pos, this);
this.playSound(soundType.getStepSound(), soundType.getVolume(), soundType.getPitch());
}
catch(Exception ex)
{
}
for (int q = 0; q < 48; q++)
{
double pft = (this.rand.nextFloat() - 0.5F) * 0.75F;
double qft = (this.rand.nextFloat() - 0.5F) * 0.75F;
this.world.spawnParticle(EnumParticleTypes.BLOCK_CRACK, this.posX + pft, this.posY + 0.5D, this.posZ + qft, 0.0D, 0.25D, 0.0D, new int[] { Block.getStateId(state) });
// EntityDiggingFX gordon = new EntityDiggingFX(world, posX + pft, posY + 0.5D, posZ + qft, 0.0D, 0.25D, 0.0D, Block.blocksList[x], 0, y);
// gordon.motionY += 0.15D + (rand.nextFloat() * 0.1D);
// ModLoader.getMinecraftInstance().effectRenderer.addEffect(gordon);
}
}
}
示例15: Smasher
import net.minecraft.block.BlockAir; //导入依赖的package包/类
public Smasher() {
super("Smasher", 0xFCC6FF, ModuleCategory.WORLD);
NukerEngine nukerEngine = new NukerEngine((pos, block) -> {
boolean blockChecks = BlockHelper.canSeeBlock(pos.getX(), pos.getY(), pos.getZ())
&& !(block instanceof BlockAir)
&& !(block instanceof BlockLiquid);
return blockChecks && block.getBlockHardness(mc.theWorld, pos) == 0;
});
listeners.addAll(nukerEngine.getListeners());
}