Package net.minecraft.world

Examples of net.minecraft.world.World


    return BaubleType.AMULET;
  }

  @Override
  public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) {
    World par2World = player.worldObj;
    if (isEnabled(par1ItemStack) && !par2World.isRemote) {
      if (player.ticksExisted % 20 == 0) {
        if (player instanceof EntityPlayer) {
          boolean removed = false;
                    int damage = 1;

          Collection<PotionEffect> potions = player.getActivePotionEffects();

          if (player.isBurning()) {
            player.extinguish();
            removed = true;
          } else for (PotionEffect potion : potions) {
            int id = potion.getPotionID();
            boolean badEffect;
            badEffect = ReflectionHelper.getPrivateValue(Potion.class, Potion.potionTypes[id], new String[]{ "isBadEffect", "field_76418_K" });
                        if (Potion.potionTypes[id] instanceof PotionWarpWard) {
                            badEffect = false;
                        }
                        if (badEffect) {
              player.removePotionEffect(id);
              removed = true;
                            int[] warpPotionIDs = new int[]{Config.potionBlurredID, Config.potionDeathGazeID, Config.potionInfVisExhaustID, Config.potionSunScornedID, Config.potionUnHungerID};
                            if (ArrayUtils.contains(warpPotionIDs, potion.getPotionID())) {
                                damage = 10;
                            }
                            break;
            }
          }

          if (removed) {


                        par1ItemStack.damageItem(damage, player);
                        par2World.playSoundAtEntity(player, "thaumcraft:wand", 0.3F, 0.1F);
          }
        }
      }
    }
  }
View Full Code Here


    return BaubleType.AMULET;
  }

  @Override
  public void onWornTick(ItemStack par1ItemStack, EntityLivingBase player) {
    World par2World = player.worldObj;
    if (par1ItemStack.getItemDamage() == 1 && !par2World.isRemote) {
      int r = LibFeatures.XP_TALISMAN_RANGE;
      int currentXP = getXP(par1ItemStack);
      int xpToAdd = 0;
      int maxXP = LibFeatures.XP_TALISMAN_MAX_XP - currentXP; // Max, to prevent overflow.
      if (maxXP <= 0) {
        par1ItemStack.setItemDamage(0);
        return; // Can't take any XP.
      }

      AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(player.posX - r, player.posY - r, player.posZ - r, player.posX + r, player.posY + r, player.posZ + r);
      List<EntityXPOrb> orbs = par2World.getEntitiesWithinAABB(EntityXPOrb.class, boundingBox);

      for (EntityXPOrb orb : orbs) {
        if (!orb.isDead) {
          int xp = orb.getXpValue();
          if (xpToAdd + xp <= maxXP) {
View Full Code Here

      message.player = TTClientProxy.getPlayer();
    else {
      message.player = ctx.getServerHandler().playerEntity;
    }
    if (server != null) {
      World world = server.worldServerForDimension(message.dim);

      if (world == null) {
        MiscHelper.printCurrentStackTrace("No world found for dimension " + message.dim + "!");
        return null;
      }

      TileEntity tile = world.getTileEntity(message.x, message.y, message.z);
      if (tile != null) {
        message.tile = (T) tile;
      }
    }
    return null;
View Full Code Here

    setHasSubtypes(true);
  }

  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsAxe))
      return false;

    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
      return false;

    ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
    int fortune = EnchantmentHelper.getFortuneModifier(player);
    boolean silk = EnchantmentHelper.getSilkTouchModifier(player);

    switch (ToolHandler.getMode(stack)) {
      case 0:
        break;
      case 1: {
        boolean doX = direction.offsetX == 0;
        boolean doY = direction.offsetY == 0;
        boolean doZ = direction.offsetZ == 0;

        ToolHandler.removeBlocksInIteration(player, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolHandler.materialsAxe, silk, fortune);
        break;
      }
      case 2: {
        Block blck = world.getBlock(x, y, z);
        if (Utils.isWoodLog(world, x, y, z)) {
          while (blck != Blocks.air) {
                        BlockUtils.breakFurthestBlock(world, x, y, z, blck, player);
            blck = world.getBlock(x, y, z);
          }

          List<EntityItem> items = world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - 5, y - 1, z - 5, x + 5, y + 64, z + 5));
          for (EntityItem item : items) {
            item.setPosition(x + 0.5, y + 0.5, z + 0.5);
            item.ticksExisted += 20;
          }
        }
View Full Code Here

    return (p_150897_1_ == Blocks.bedrock) || super.func_150897_b(p_150897_1_);
  }

  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsPick))
      return false;

    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
      return false;

    Block blk = world.getBlock(x, y, z);

    ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
    int fortune = EnchantmentHelper.getFortuneModifier(player);
    boolean silk = EnchantmentHelper.getSilkTouchModifier(player);
    if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock && ((world.provider.isSurfaceWorld() && y < 5) || (y > 253 && world.provider instanceof WorldProviderBedrock))) {
      world.setBlock(x, y, z, ThaumicTinkerer.registry.getFirstBlockFromClass(BlockBedrockPortal.class));
    }
    if (ConfigHandler.bedrockDimensionID != 0 && blk == Blocks.bedrock && (y <= 253 && world.provider instanceof WorldProviderBedrock)) {
      world.setBlock(x, y, z, Blocks.air);
    }
    switch (ToolHandler.getMode(stack)) {
      case 0:
        break;
      case 1: {
View Full Code Here

    return par1ItemStack;
  }

  @Override
  public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) {
    World world = player.worldObj;
    Material mat = world.getBlock(x, y, z).getMaterial();
    if (!ToolHandler.isRightMaterial(mat, ToolHandler.materialsShovel))
      return false;
    MovingObjectPosition block = ToolHandler.raytraceFromEntity(world, player, true, 4.5);
    if (block == null)
      return false;

    ForgeDirection direction = ForgeDirection.getOrientation(block.sideHit);
    int fortune = EnchantmentHelper.getFortuneModifier(player);
    boolean silk = EnchantmentHelper.getSilkTouchModifier(player);

    switch (ToolHandler.getMode(stack)) {
      case 0:
        break;
      case 1: {
        boolean doX = direction.offsetX == 0;
        boolean doY = direction.offsetY == 0;
        boolean doZ = direction.offsetZ == 0;

        ToolHandler.removeBlocksInIteration(player, world, x, y, z, doX ? -2 : 0, doY ? -1 : 0, doZ ? -2 : 0, doX ? 3 : 1, doY ? 4 : 1, doZ ? 3 : 1, null, ToolHandler.materialsShovel, silk, fortune);
        break;
      }
      case 2: {
        Block blk = world.getBlock(x, y, z);
        ToolHandler.removeBlocksInIteration(player, world, x, y, z, 0, -8, 0, 1, 8, 1, blk, ToolHandler.materialsShovel, silk, fortune);
        break;
      }
    }
    return false;
View Full Code Here

    public abstract World getWorld(T target);

    @Override
    public Object[] execute(final Object target, IComputerAccess computer, ILuaContext context, final Callable<Object[]> callable) throws Exception {
      @SuppressWarnings("unchecked")
      World world = getWorld((T)target);
      Preconditions.checkNotNull(world, "Trying to execute OnTick method, but no available world");

      final Responder responder = new Responder(context, computer);
View Full Code Here

  RenderBlocks blockRender = new RenderBlocks();

  @SubscribeEvent
  public void onWorldRenderLast(RenderWorldLastEvent event) {

    World world = Minecraft.getMinecraft().theWorld;
    List<EntityPlayer> playerEntities = world.playerEntities;
    for (EntityPlayer player : playerEntities) {
      ItemStack currentStack = player.getCurrentEquippedItem();
      if (currentStack != null && currentStack.getItem() == ThaumicTinkerer.registry.getFirstItemFromClass(ItemPlacementMirror.class) && ItemPlacementMirror.getBlock(currentStack) != Blocks.air) {
        renderPlayerLook(player, currentStack);
View Full Code Here

     *
     * @return the world
     * @throws WorldEditException thrown if a reference to the world was lost (i.e. world was unloaded)
     */
    public World getWorldChecked() throws WorldEditException {
        World world = worldRef.get();
        if (world != null) {
            return world;
        } else {
            throw new WorldReferenceLostException("The reference to the world was lost (i.e. the world may have been unloaded)");
        }
View Full Code Here

     *
     * @return the world
     * @throws RuntimeException thrown if a reference to the world was lost (i.e. world was unloaded)
     */
    public World getWorld() {
        World world = worldRef.get();
        if (world != null) {
            return world;
        } else {
            throw new RuntimeException("The reference to the world was lost (i.e. the world may have been unloaded)");
        }
View Full Code Here

TOP

Related Classes of net.minecraft.world.World

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.