Java Code Examples for net.minecraft.block.state.IBlockState#isFullCube()
The following examples show how to use
net.minecraft.block.state.IBlockState#isFullCube() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: InfinitePain.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@SubscribeEvent public static void onLanding(LivingFallEvent event) { EntityLivingBase elb = event.getEntityLiving(); if(elb.hasItemInSlot(EntityEquipmentSlot.FEET) && elb.getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem() == PAIN_BOOTS) { if(event.getDistance() >= minTriggerHeight) { boolean notObstructed = true; double impactPosition = 0; for(int i = (int) elb.posY + 2; i < elb.world.provider.getHeight(); i++) { BlockPos pos = new BlockPos(elb.posX, i, elb.posZ); IBlockState state = elb.world.getBlockState(pos); if(state.isFullBlock() || state.isFullCube()) { notObstructed = false; impactPosition = i; break; } } if(notObstructed) { elb.setPositionAndUpdate(elb.posX, elb.world.provider.getHeight() + heightToAdd, elb.posZ); event.setDamageMultiplier(0); } else { elb.addVelocity(0, (impactPosition - elb.posY) / 2, 0); elb.attackEntityFrom(DamageSource.GENERIC, damageOnImpact); event.setDamageMultiplier(0); } } } }
Example 2
Source File: InfinitePain.java From CommunityMod with GNU Lesser General Public License v2.1 | 5 votes |
@SubscribeEvent public static void onLandingCreative(PlayerFlyableFallEvent event) { EntityLivingBase elb = event.getEntityLiving(); if(elb.hasItemInSlot(EntityEquipmentSlot.FEET) && elb.getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem() == PAIN_BOOTS) { if(event.getDistance() >= minTriggerHeight) { boolean notObstructed = true; double impactPosition = 0; for(int i = (int) elb.posY + 2; i < elb.world.provider.getHeight(); i++) { BlockPos pos = new BlockPos(elb.posX, i, elb.posZ); IBlockState state = elb.world.getBlockState(pos); if(state.isFullBlock() || state.isFullCube()) { notObstructed = false; impactPosition = i; break; } } if(notObstructed) { elb.setPositionAndUpdate(elb.posX, elb.world.provider.getHeight() + heightToAdd, elb.posZ); } else { elb.addVelocity(0, (impactPosition - elb.posY) / 2, 0); } } } }
Example 3
Source File: FacadeHelper.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
public static boolean isValidFacade(ItemStack itemStack) { IBlockState rawBlockState = lookupBlockForItemUnsafe(itemStack); return rawBlockState != null && !rawBlockState.getBlock().hasTileEntity(rawBlockState) && !rawBlockState.getBlock().hasTileEntity() && rawBlockState.getRenderType() == EnumBlockRenderType.MODEL && rawBlockState.isFullCube(); }
Example 4
Source File: PotionCrash.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true) public void fall(LivingFallEvent e) { EntityLivingBase entitySource = e.getEntityLiving(); PotionEffect crash = entitySource.getActivePotionEffect(this); if (crash == null) return; PotionEffect jump = entitySource.getActivePotionEffect(MobEffects.JUMP_BOOST); float f = (jump == null) ? 0.0f : (jump.getAmplifier() + 1); float damage = MathHelper.clamp((e.getDistance() - 3.0f - f) * e.getDamageMultiplier() * 2, 0, 10f); float range = damage / 10f + Math.max(crash.getAmplifier(), 5); if (damage > 0.0f) { e.setDamageMultiplier(e.getDamageMultiplier() / (crash.getAmplifier() + 2)); List<EntityLivingBase> entities = entitySource.world.getEntitiesWithinAABB(EntityLivingBase.class, entitySource.getEntityBoundingBox().grow(range * 2)); entities.stream().filter(entity -> entity != entitySource && entity.onGround).forEach(entity -> { entity.attackEntityFrom(damageSourceEarthquake(entitySource), range); entity.motionY = range / 10.0; entity.velocityChanged = true; }); if (!entitySource.world.isRemote) for (BlockPos pos : BlockPos.getAllInBoxMutable( new BlockPos(entitySource.getPositionVector()) .add(-range, -2, -range), new BlockPos(entitySource.getPositionVector()) .add(range, 0, range))) { IBlockState state = entitySource.world.getBlockState(pos); if (state.isFullCube()) entitySource.world.playEvent(2001, pos.toImmutable(), Block.getStateId(state)); } } }
Example 5
Source File: BlockYubaNoren.java From TofuCraftReload with MIT License | 4 votes |
protected boolean canSustainNoren(IBlockState state) { return state.isFullCube(); }
Example 6
Source File: BlockNoren.java From Sakura_mod with MIT License | 4 votes |
protected boolean canSustainNoren(IBlockState state) { return state.isFullCube(); }
Example 7
Source File: EntityAIFollowPlayer.java From Wizardry with GNU Lesser General Public License v3.0 | 4 votes |
private boolean isEmptyBlock(BlockPos pos) { IBlockState iblockstate = this.world.getBlockState(pos); return iblockstate.getMaterial() == Material.AIR || !iblockstate.isFullCube(); }
Example 8
Source File: BlockBeaconPost.java From Cyberware with MIT License | 4 votes |
public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos) { IBlockState iblockstate = worldIn.getBlockState(pos); Block block = iblockstate.getBlock(); return block == Blocks.BARRIER ? false : ((!(block instanceof BlockBeaconPost) || block.getMaterial(iblockstate) != this.blockMaterial) && !(block instanceof BlockFenceGate) ? (block.getMaterial(iblockstate).isOpaque() && iblockstate.isFullCube() ? block.getMaterial(iblockstate) != Material.GOURD : false) : true); }
Example 9
Source File: TemplateEnderUtilities.java From enderutilities with GNU Lesser General Public License v3.0 | 4 votes |
public void takeBlocksFromWorld(World worldIn, BlockPos posStart, BlockPos posEndRelative, boolean takeEntities, boolean cbCrossWorld) { BlockPos endPos = posStart.add(posEndRelative); List<TemplateEnderUtilities.TemplateBlockInfo> list = Lists.<TemplateEnderUtilities.TemplateBlockInfo>newArrayList(); List<TemplateEnderUtilities.TemplateBlockInfo> list1 = Lists.<TemplateEnderUtilities.TemplateBlockInfo>newArrayList(); List<TemplateEnderUtilities.TemplateBlockInfo> list2 = Lists.<TemplateEnderUtilities.TemplateBlockInfo>newArrayList(); this.size = PositionUtils.getAreaSizeFromRelativeEndPosition(posEndRelative); for (BlockPos.MutableBlockPos posMutable : BlockPos.getAllInBoxMutable(posStart, endPos)) { BlockPos posRelative = posMutable.subtract(posStart); IBlockState state = worldIn.getBlockState(posMutable); TileEntity te = worldIn.getTileEntity(posMutable); if (te != null) { NBTTagCompound tag = new NBTTagCompound(); if (cbCrossWorld) { tag = chiselsAndBitsHandler.writeChiselsAndBitsTileToNBT(tag, te); } else { tag = te.writeToNBT(tag); } tag.removeTag("x"); tag.removeTag("y"); tag.removeTag("z"); list1.add(new TemplateEnderUtilities.TemplateBlockInfo(posRelative, state, tag)); } else if (state.isFullBlock() == false && state.isFullCube() == false) { list2.add(new TemplateEnderUtilities.TemplateBlockInfo(posRelative, state, null)); } else { list.add(new TemplateEnderUtilities.TemplateBlockInfo(posRelative, state, null)); } } this.blocks.clear(); this.blocks.addAll(list); this.blocks.addAll(list1); this.blocks.addAll(list2); if (takeEntities) { this.takeEntitiesFromWorld(worldIn, posStart, posEndRelative); } else { this.entities.clear(); } }