Java Code Examples for net.minecraft.init.Blocks#END_PORTAL_FRAME

The following examples show how to use net.minecraft.init.Blocks#END_PORTAL_FRAME . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: Sakura_mod   File: ItemSakuraDiamond.java    License: MIT License 6 votes vote down vote up
@Override
  public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
      ItemStack itemstack = playerIn.getHeldItem(handIn);
      RayTraceResult raytraceresult = this.rayTrace(worldIn, playerIn, false);

      if (raytraceresult != null && raytraceresult.typeOfHit == RayTraceResult.Type.BLOCK && worldIn.getBlockState(raytraceresult.getBlockPos()).getBlock() == Blocks.END_PORTAL_FRAME) {
          return new ActionResult<ItemStack>(EnumActionResult.PASS, itemstack);
      }
if (worldIn.isRemote) {
    int j = worldIn.rand.nextInt(2) * 2 - 1;
    int k = worldIn.rand.nextInt(2) * 2 - 1;

    double d0 = playerIn.getPosition().getX() + 0.25D * j;
    double d1 = playerIn.getPosition().getY() + 1D;
    double d2 = playerIn.getPosition().getZ() + 0.25D * k;
    double d3 = worldIn.rand.nextFloat() * j * 0.1D;
    double d4 = (worldIn.rand.nextFloat() * 0.055D) + 0.015D;
    double d5 = worldIn.rand.nextFloat() * k * 0.1D;

    SakuraMain.proxy.spawnParticle(SakuraParticleType.LEAVESSAKURA, d0, d1, d2, d3, -d4, d5);
}
return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemstack);
  }
 
Example 2
public static boolean resetEndPortalFrame(World world, BlockPos pos, IBlockState portalFrameState) {
	if (portalFrameState.getBlock() == Blocks.END_PORTAL_FRAME
			&& portalFrameState.getValue(BlockEndPortalFrame.EYE).booleanValue()) {
		world.setBlockState(pos, portalFrameState.withProperty(BlockEndPortalFrame.EYE, false));
		world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_END_PORTAL_FRAME_FILL, SoundCategory.BLOCKS, 0.5F, 0.5F
				+ world.rand.nextFloat());
		return true;
	}
	return false;
}
 
Example 3
@Override
public boolean isValidBlock(IBlockState state) {
	return state.getBlock() == Blocks.END_PORTAL || state.getBlock() == Blocks.END_PORTAL_FRAME;
}
 
Example 4
@Override
public boolean isValidBlock(World world, BlockPos pos) {
	return world.getBlockState(pos).getBlock() == Blocks.END_PORTAL
			|| world.getBlockState(pos).getBlock() == Blocks.END_PORTAL_FRAME;
}