本文整理匯總了Java中net.minecraft.block.BlockLeaves類的典型用法代碼示例。如果您正苦於以下問題:Java BlockLeaves類的具體用法?Java BlockLeaves怎麽用?Java BlockLeaves使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
BlockLeaves類屬於net.minecraft.block包,在下文中一共展示了BlockLeaves類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: findLeaves
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
protected void findLeaves(BlockPos pos, World world) {
int offs = 4;
for (int x = -offs; x <= offs; x++) {
for (int y = -offs; y <= offs; y++) {
for (int z = -offs; z <= offs; z++) {
BlockPos p = pos.add(x, y, z);
IBlockState st = world.getBlockState(p);
if (st.getBlock().isLeaves(st, world, p)) {
if (st.getValue(BlockLeaves.DECAYABLE)) {
leavesToTick.put(p, 500);
}
}
}
}
}
}
示例2: isSmartLeaves
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
public boolean isSmartLeaves()
{
if (this.smartLeaves == -1)
{
if (Config.isTreesSmart() && this.blockState.getBlock() instanceof BlockLeaves)
{
this.smartLeaves = 1;
}
else
{
this.smartLeaves = 0;
}
}
return this.smartLeaves == 1;
}
示例3: nearSurface
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
boolean nearSurface(World world, int posX, int posY, int posZ) {
if (!world.isAirBlock(new BlockPos(posX, posY, posZ))) return false;
int tries = 5;
while (tries-- > 0) {
Block block = world.getBlockState(new BlockPos(posX, --posY, posZ)).getBlock();
if (block == Blocks.snow ||
block == Blocks.ice ||
block instanceof BlockTopSoil ||
block instanceof BlockSubSoil ||
block instanceof BlockLeaves ||
block instanceof BlockTallGrassVC ||
BlocksVC.rock.containsBlock(block) ||
BlocksVC.gravel.containsBlock(block) ||
BlocksVC.sand.containsBlock(block)
) {
return true;
}
}
return false;
}
示例4: onUpdate
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
@Override
public void onUpdate(){
oldMotionX = motionX;
oldMotionY = motionY;
oldMotionZ = motionZ;
super.onUpdate();
//blowOtherEntities();
motionX *= 0.95D;// equal to the potion effect friction. 0.95F
motionY *= 0.95D;
motionZ *= 0.95D;
if(motionX * motionX + motionY * motionY + motionZ * motionZ < 0.1D) {
setDead();
}
if(!worldObj.isRemote) {
int blockX = (int)Math.floor(posX);
int blockY = (int)Math.floor(posY);
int blockZ = (int)Math.floor(posZ);
for(int i = 0; i < 7; i++) { // to 7 so the middle block will also trigger (with UNKNOWN direction)
Block block = worldObj.getBlock(blockX + ForgeDirection.getOrientation(i).offsetX, blockY + ForgeDirection.getOrientation(i).offsetY, blockZ + ForgeDirection.getOrientation(i).offsetZ);
if(block instanceof IPlantable || block instanceof BlockLeaves) {
worldObj.func_147480_a(blockX + ForgeDirection.getOrientation(i).offsetX, blockY + ForgeDirection.getOrientation(i).offsetY, blockZ + ForgeDirection.getOrientation(i).offsetZ, true);
}
}
}
}
示例5: tryCutPlants
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
private boolean tryCutPlants(BlockPos pos) {
Block block = world.getBlockState(pos).getBlock();
if (block instanceof IPlantable || block instanceof BlockLeaves) {
world.destroyBlock(pos, true);
return true;
}
return false;
}
示例6: onImpact
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
@Override
protected void onImpact(RayTraceResult objectPosition) {
if (objectPosition.entityHit != null) {
Entity entity = objectPosition.entityHit;
entity.motionX += motionX;
entity.motionY += motionY;
entity.motionZ += motionZ;
if (!entity.world.isRemote && entity instanceof IShearable) {
IShearable shearable = (IShearable) entity;
BlockPos pos = new BlockPos(posX, posY, posZ);
if (shearable.isShearable(ItemStack.EMPTY, world, pos)) {
List<ItemStack> drops = shearable.onSheared(ItemStack.EMPTY, world, pos, 0);
for (ItemStack stack : drops) {
PneumaticCraftUtils.dropItemOnGround(stack, world, entity.posX, entity.posY, entity.posZ);
}
}
}
} else {
Block block = world.getBlockState(objectPosition.getBlockPos()).getBlock();
if (block instanceof IPlantable || block instanceof BlockLeaves) {
motionX = oldMotionX;
motionY = oldMotionY;
motionZ = oldMotionZ;
} else {
setDead();
}
}
hitCounter++;
if (hitCounter > 20) setDead();
}
示例7: generateLeafNode
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
/**
* Generates the leaves surrounding an individual entry in the leafNodes list.
*/
void generateLeafNode(BlockPos pos)
{
for (int i = 0; i < this.leafDistanceLimit; ++i)
{
this.func_181631_a(pos.up(i), this.leafSize(i), Blocks.leaves.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
}
}
示例8: ItemLeaves
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
public ItemLeaves(BlockLeaves block)
{
super(block);
this.leaves = block;
this.setMaxDamage(0);
this.setHasSubtypes(true);
}
示例9: entityDropItem
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
@Nullable
@Override
public EntityItem entityDropItem(ItemStack stack, float offsetY) {
IBlockState state = getBlock();
if (state != null && state.getBlock() instanceof BlockLeaves) {
BlockLeaves leaves = (BlockLeaves) state.getBlock();
for (ItemStack item : leaves.getDrops(worldObj, getPosition(), state, 0)) {
super.entityDropItem(item, offsetY);
}
return null;
}
return super.entityDropItem(stack, offsetY);
}
示例10: entityDropItem
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
@Nullable
@Override
public EntityItem entityDropItem(ItemStack stack, float offsetY) {
IBlockState state = getBlock();
if (state != null && state.getBlock() instanceof BlockLeaves) {
BlockLeaves leaves = (BlockLeaves) state.getBlock();
for (ItemStack item : leaves.getDrops(world, getPosition(), state, 0)) {
super.entityDropItem(item, offsetY);
}
return null;
}
return super.entityDropItem(stack, offsetY);
}
示例11: registerModels
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
@SubscribeEvent
@SideOnly(Side.CLIENT)
public static void registerModels(final ModelRegistryEvent event) {
for (final Item item : ITEMS) {
ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(), "inventory"));
}
for (final Block block : BLOCKS) {
if (block instanceof BlockLeaves) {
ModelLoader.setCustomStateMapper(block, new StateMap.Builder().ignore(BlockLeaves.CHECK_DECAY, BlockLeaves.DECAYABLE).build());
}
}
}
示例12: generateLeafNode
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
/**
* Generates the leaves surrounding an individual entry in the leafNodes list.
*/
void generateLeafNode(BlockPos pos)
{
for (int i = 0; i < this.leafDistanceLimit; ++i)
{
this.crosSection(pos.up(i), this.leafSize(i), Blocks.LEAVES.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
}
}
示例13: generateLeafNode
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
/**
* Generates the leaves surrounding an individual entry in the leafNodes list.
*/
void generateLeafNode(BlockPos pos)
{
for (int i = 0; i < this.leafDistanceLimit; ++i)
{
this.crosSection(pos.up(i), this.leafSize(i), leaves.withProperty(BlockLeaves.CHECK_DECAY, Boolean.valueOf(false)));
}
}
示例14: EnderTreeNormalGen
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
public EnderTreeNormalGen(boolean notify) {
super(notify);
this.minTreeHeight = 4;
this.metaWood = Blocks.LOG.getDefaultState().withProperty(BlockOldLog.VARIANT, BlockPlanks.EnumType.OAK);
this.oakLeaves = Blocks.LEAVES.getDefaultState().withProperty(BlockOldLeaf.VARIANT,
BlockPlanks.EnumType.OAK).withProperty(BlockLeaves.CHECK_DECAY, false);
this.enderLeaves = IWTechBlocks.BLOCK_ENDER_LEAVES.getDefaultState();
}
示例15: seedMap
import net.minecraft.block.BlockLeaves; //導入依賴的package包/類
private void seedMap() {
// Iterate through the blockmap looking for known pattern types.
// Though they probably should all be registered with Forge
// dictionary it's not a requirement.
final Iterator<Block> itr = Block.REGISTRY.iterator();
while (itr.hasNext()) {
final Block block = itr.next();
final String blockName = MCHelper.nameOf(block);
if (block instanceof BlockCrops) {
final BlockCrops crop = (BlockCrops) block;
if (crop.getMaxAge() == 3) {
this.registerBlocks("#beets", blockName);
} else if (blockName.equals("minecraft:wheat")) {
this.registerBlocks("#wheat", blockName);
} else if (crop.getMaxAge() == 7) {
this.registerBlocks("#crop", blockName);
}
} else if (block instanceof BlockSapling) {
this.registerBlocks("#sapling", blockName);
} else if (block instanceof BlockReed) {
this.registerBlocks("#reed", blockName);
} else if (block instanceof BlockFence) {
this.registerBlocks("#fence", blockName);
} else if (block instanceof BlockFlower || block instanceof BlockMushroom) {
this.registerBlocks("NOT_EMITTER", blockName);
} else if (block instanceof BlockLog || block instanceof BlockPlanks) {
this.registerBlocks("wood", blockName);
} else if (block instanceof BlockDoor) {
this.registerBlocks("bluntwood", blockName);
} else if (block instanceof BlockLeaves) {
this.registerBlocks("leaves", blockName);
} else if (block instanceof BlockOre) {
this.registerBlocks("ore", blockName);
} else if (block instanceof BlockIce) {
this.registerBlocks("ice", blockName);
}
}
}