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 . 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: ItemSakuraDiamond.java    From Sakura_mod with 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
Source File: GTUtility.java    From GT-Classic with GNU Lesser General Public License v3.0 5 votes vote down vote up
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
Source File: GTIBlockFilters.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isValidBlock(IBlockState state) {
	return state.getBlock() == Blocks.END_PORTAL || state.getBlock() == Blocks.END_PORTAL_FRAME;
}
 
Example 4
Source File: GTIBlockFilters.java    From GT-Classic with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public boolean isValidBlock(World world, BlockPos pos) {
	return world.getBlockState(pos).getBlock() == Blocks.END_PORTAL
			|| world.getBlockState(pos).getBlock() == Blocks.END_PORTAL_FRAME;
}