use of net.minecraft.block.BlockLeaves in project PneumaticCraft by MineMaarten.
the class EntityVortex method onUpdate.
@Override
public void onUpdate() {
oldMotionX = motionX;
oldMotionY = motionY;
oldMotionZ = motionZ;
super.onUpdate();
//blowOtherEntities();
// equal to the potion effect friction. 0.95F
motionX *= 0.95D;
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);
}
}
}
}
use of net.minecraft.block.BlockLeaves in project PneumaticCraft by MineMaarten.
the class EntityVortex method onImpact.
@Override
protected void onImpact(MovingObjectPosition objectPosition) {
if (objectPosition.entityHit != null) {
Entity entity = objectPosition.entityHit;
entity.motionX += motionX;
entity.motionY += motionY;
entity.motionZ += motionZ;
if (!entity.worldObj.isRemote && entity instanceof IShearable) {
IShearable shearable = (IShearable) entity;
int x = (int) Math.floor(posX);
int y = (int) Math.floor(posY);
int z = (int) Math.floor(posZ);
if (shearable.isShearable(null, worldObj, x, y, z)) {
List<ItemStack> drops = shearable.onSheared(null, worldObj, x, y, z, 0);
for (ItemStack stack : drops) {
PneumaticCraftUtils.dropItemOnGround(stack, worldObj, entity.posX, entity.posY, entity.posZ);
}
}
}
} else {
Block block = worldObj.getBlock(objectPosition.blockX, objectPosition.blockY, objectPosition.blockZ);
if (block instanceof IPlantable || block instanceof BlockLeaves) {
motionX = oldMotionX;
motionY = oldMotionY;
motionZ = oldMotionZ;
} else {
setDead();
}
}
hitCounter++;
if (hitCounter > 20)
setDead();
}
use of net.minecraft.block.BlockLeaves in project Realistic-Terrain-Generation by Team-RTG.
the class DecoBase method tweakTreeLeaves.
public static void tweakTreeLeaves(DecoTree deco, boolean checkDecay, boolean decayable) {
if (deco.getLeavesBlock().getBlock() instanceof BlockLeaves) {
IBlockState leaves = deco.getLeavesBlock().withProperty(BlockLeaves.CHECK_DECAY, checkDecay).withProperty(BlockLeaves.DECAYABLE, decayable);
deco.setLeavesBlock(leaves);
}
}
use of net.minecraft.block.BlockLeaves in project Realistic-Terrain-Generation by Team-RTG.
the class DecoBase method tweakShrubLeaves.
public static void tweakShrubLeaves(DecoShrub deco, boolean checkDecay, boolean decayable) {
if (deco.getLeavesBlock().getBlock() instanceof BlockLeaves) {
IBlockState leaves = deco.getLeavesBlock().withProperty(BlockLeaves.CHECK_DECAY, checkDecay).withProperty(BlockLeaves.DECAYABLE, decayable);
deco.setLeavesBlock(leaves);
}
}
Aggregations