本文整理匯總了Java中net.minecraft.block.BlockFalling.canFallThrough方法的典型用法代碼示例。如果您正苦於以下問題:Java BlockFalling.canFallThrough方法的具體用法?Java BlockFalling.canFallThrough怎麽用?Java BlockFalling.canFallThrough使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.block.BlockFalling
的用法示例。
在下文中一共展示了BlockFalling.canFallThrough方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: canBuildAt
import net.minecraft.block.BlockFalling; //導入方法依賴的package包/類
public boolean canBuildAt(BlockPos blockpos) {
return !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.EAST)))
|| !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.WEST)))
|| !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.UP)))
|| !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.DOWN)))
|| !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.SOUTH)))
|| !BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.NORTH)));
}
示例2: vanillaUpdateMod
import net.minecraft.block.BlockFalling; //導入方法依賴的package包/類
private void vanillaUpdateMod(){
if (getBlock().getMaterial() == Material.AIR){
this.setDead();
}
else{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (!this.hasNoGravity())
{
this.motionY -= 0.03999999910593033D;
}
if(onGround || no_gravity)this.motionY = 0;
this.move(MoverType.SELF, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (!this.getEntityWorld().isRemote){
if (this.onGround){
if (this.getEntityWorld().isAirBlock(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) //Forge: Don't indent below.
if (BlockFalling.canFallThrough(this.getEntityWorld().getBlockState(new BlockPos(this.posX, this.posY - 0.009999999776482582D, this.posZ))) && !no_gravity){
this.onGround = false;
return;
}
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
}
}
}
}
示例3: placeBlock
import net.minecraft.block.BlockFalling; //導入方法依賴的package包/類
public boolean placeBlock(BlockPos blockpos) {
Block block = this.block.getBlock();
IBlockState prevstate=this.world.getBlockState(blockpos);
if (!this.isBreakingAnvil
&& this.world.mayPlace(block, blockpos, true, EnumFacing.UP, (Entity) null)
&& (!BlockFalling.canFallThrough(this.world.getBlockState(blockpos.offset(EnumFacing.DOWN)))
|| (this.sticky == 1 && this.canBuildAt(blockpos)) || this.nogravity)
&& this.world.setBlockState(blockpos, this.block, 3)) {
if (this.isFired)
for (int a = 0; a < 6; a++) {
EnumFacing facing = EnumFacing.VALUES[a];
BlockPos firepos = new BlockPos(blockpos.getX() + facing.getFrontOffsetX(),
blockpos.getY() + facing.getFrontOffsetY(), blockpos.getZ() + facing.getFrontOffsetZ());
if (this.world.getBlockState(firepos).getBlock().isReplaceable(world, firepos))
this.world.setBlockState(firepos, this.fireBlock.getDefaultState());
}
if (block instanceof BlockFalling)
((BlockFalling) block).onEndFalling(this.world, blockpos, this.block, prevstate);
if (this.dataTag != null && block instanceof ITileEntityProvider) {
TileEntity tileentity = this.world.getTileEntity(blockpos);
if (tileentity != null) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
tileentity.writeToNBT(nbttagcompound);
Iterator iterator = this.dataTag.getKeySet().iterator();
while (iterator.hasNext()) {
String s = (String) iterator.next();
NBTBase nbtbase = this.dataTag.getTag(s);
if (!s.equals("x") && !s.equals("y") && !s.equals("z"))
nbttagcompound.setTag(s, nbtbase.copy());
}
tileentity.readFromNBT(nbttagcompound);
tileentity.markDirty();
}
}
return true;
}
return false;
}
示例4: onUpdate
import net.minecraft.block.BlockFalling; //導入方法依賴的package包/類
/**
* Called to update the entity's position/logic.
*/
@Override
public void onUpdate() {
Block block = this.fallTile.getBlock();
if (block.getMaterial(this.fallTile) == Material.AIR) {
this.setDead();
} else {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.fallTime++ == 0) {
BlockPos blockpos = new BlockPos(this);
if (this.getEntityWorld().getBlockState(blockpos).getBlock() == block) {
this.getEntityWorld().setBlockToAir(blockpos);
} else if (!this.getEntityWorld().isRemote) {
this.setDead();
return;
}
}
this.motionY -= 0.03999999910593033D;
EntityTools.moveEntity(this, this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9800000190734863D;
this.motionY *= 0.9800000190734863D;
this.motionZ *= 0.9800000190734863D;
if (!this.getEntityWorld().isRemote) {
BlockPos blockpos1 = new BlockPos(this);
if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
this.motionY *= -0.5D;
if (this.getEntityWorld().getBlockState(blockpos1).getBlock() != Blocks.PISTON_EXTENSION) {
this.setDead();
if (!this.canSetAsBlock) {
if (mayPlace(this.getEntityWorld(), block, blockpos1, true, EnumFacing.UP, null)) {
if (!BlockFalling.canFallThrough(this.getEntityWorld().getBlockState(blockpos1.down())) && this.getEntityWorld().setBlockState(blockpos1, this.fallTile, 3)) {
if (block instanceof BlockFalling) {
((BlockFalling) block).onEndFalling(this.getEntityWorld(), blockpos1);
}
}
}
}
}
} else if (this.fallTime > 100 && !this.getEntityWorld().isRemote && (blockpos1.getY() < 1 || blockpos1.getY() > 256) || this.fallTime > 600) {
this.setDead();
}
}
}
}