@Override
  @SideOnly(Side.CLIENT)
  public boolean hasEffect(ItemStack stack) {
    EntityPlayerSP thePlayer = FMLClientHandler.instance().getClientPlayerEntity();
    WorldClient theWorld = FMLClientHandler.instance().getWorldClient();
    BlockPos pos = new BlockPos(thePlayer.posX, thePlayer.posY, thePlayer.posZ);

    BiomeGenBase biome = theWorld.getBiomeGenForCoords(pos);
    return BiomeDictionary.isBiomeOfType(biome, Type.MAGICAL);
  }
  @Override
  @SideOnly(Side.CLIENT)
  public int getColorFromItemStack(ItemStack stack, int renderPass) {
    EntityPlayerSP thePlayer = FMLClientHandler.instance().getClientPlayerEntity();
    WorldClient theWorld = FMLClientHandler.instance().getWorldClient();
    BlockPos pos = new BlockPos(thePlayer.posX, thePlayer.posY, thePlayer.posZ);

    int foliageColor = BiomeColorHelper.getFoliageColorAtPos(theWorld, pos);
    int waterColor = BiomeColorHelper.getWaterColorAtPos(theWorld, pos);
    int grassColor = BiomeColorHelper.getGrassColorAtPos(theWorld, pos);

    return foliageColor;
  }
 @Override
 public IMessage onMessage(MessageTrackerDataResponse message, MessageContext ctx) {
   IMixinMinecraft spongeMc = (IMixinMinecraft) FMLClientHandler.instance().getClient();
   IMixinGuiOverlayDebug debugGui = (IMixinGuiOverlayDebug) spongeMc.getDebugGui();
   debugGui.setPlayerTrackerData(message.owner, message.notifier);
   return null;
 }
 private BattlegearClientTickHandeler() {
   drawWeapons = new KeyBinding("Draw Weapons", Keyboard.KEY_R, "key.categories.gameplay");
   special = new KeyBinding("Special", Keyboard.KEY_Z, "key.categories.gameplay");
   ClientRegistry.registerKeyBinding(drawWeapons);
   ClientRegistry.registerKeyBinding(special);
   mc = FMLClientHandler.instance().getClient();
 }
 @SideOnly(Side.CLIENT)
 private final EntityVehicle getClosestEntity() {
   World world = FMLClientHandler.instance().getServer().getEntityWorld();
   List<Entity> entities = world.getLoadedEntityList();
   EntityVehicle i = null;
   EntityPlayer p = FMLClientHandler.instance().getClientPlayerEntity();
   for (Entity e : entities) {
     if (e instanceof EntityVehicle) {
       if (i == null) {
         i = (EntityVehicle) e;
       } else if (p.getDistanceSqToEntity(e) < p.getDistanceSqToEntity(i)) {
         i = (EntityVehicle) e;
       }
     }
   }
   return i;
 }
 @Override
 public void registerEventHandlers() {
   super.registerEventHandlers();
   WMClientEventHandler eventhandler = new WMClientEventHandler();
   FMLCommonHandler.instance().bus().register(eventhandler);
   MinecraftForge.EVENT_BUS.register(eventhandler);
   MinecraftForge.EVENT_BUS.register(
       new GuiOverlayReloaded(FMLClientHandler.instance().getClient()));
 }
 private BattlegearClientEvents() {
   inGameGUI = new BattlegearInGameGUI();
   quiverModel = new QuiverModel();
   quiverDetails =
       new ResourceLocation("battlegear2", "textures/armours/quiver/QuiverDetails.png");
   quiverBase = new ResourceLocation("battlegear2", "textures/armours/quiver/QuiverBase.png");
   ((IReloadableResourceManager) FMLClientHandler.instance().getClient().getResourceManager())
       .registerReloadListener(this);
 }
  @SubscribeEvent
  public void onPacketReceive(ClientCustomPacketEvent event) {
    // This method receives the TerrainControl packet with the custom
    // biome colors and weather.

    FMLProxyPacket receivedPacket = event.getPacket();

    // We're on the client, receive the packet
    ByteBuf stream = receivedPacket.payload();
    try {
      int serverProtocolVersion = stream.readInt();
      int clientProtocolVersion = PluginStandardValues.ProtocolVersion;
      if (serverProtocolVersion == clientProtocolVersion) {
        // Server sent config
        WorldClient worldMC = FMLClientHandler.instance().getClient().theWorld;

        if (stream.readableBytes() > 4 && worldMC != null) {
          // If the packet wasn't empty, and the client world exists:
          // add the new biomes.
          // (If no client world exists yet, then we're on a local
          // server, and we can discard the packet.)

          DataInputStream wrappedStream = new DataInputStream(new ByteBufInputStream(stream));

          worldLoader.demandClientWorld(worldMC, wrappedStream);
        }

        TerrainControl.log(LogMarker.INFO, "Config received from server");
      } else {
        // Server or client is outdated
        if (serverProtocolVersion > PluginStandardValues.ProtocolVersion) {
          sendMessage(
              TextFormatting.GREEN,
              "The server is running a newer version of "
                  + PluginStandardValues.PLUGIN_NAME
                  + ". Please update!");
        } else {
          sendMessage(
              TextFormatting.YELLOW,
              "The server is running an outdated version of "
                  + PluginStandardValues.PLUGIN_NAME
                  + ". Cannot load custom biome colors and weather.");
        }
        TerrainControl.log(
            LogMarker.WARN,
            "Server has different protocol version. Client: {} Server: {}",
            PluginStandardValues.ProtocolVersion,
            serverProtocolVersion);
      }
    } catch (Exception e) {
      TerrainControl.log(LogMarker.FATAL, "Failed to receive packet");
      TerrainControl.printStackTrace(LogMarker.FATAL, e);
      TerrainControl.log(LogMarker.FATAL, "Packet contents: {}", Arrays.toString(stream.array()));
      sendMessage(TextFormatting.RED, "Error receiving packet.");
    }
  }
Beispiel #9
0
  public void spawn() {

    /*
    WorldClient world = FMLClientHandler.instance().getClient().theWorld;

    if (null != world)
        world.spawnEntityInWorld(this);
    */
    FMLClientHandler.instance().getClient().effectRenderer.addEffect(this);
  }
 @SubscribeEvent(priority = EventPriority.LOW)
 public void postInitGui(GuiScreenEvent.InitGuiEvent.Post event) {
   if (Battlegear.battlegearEnabled && event.gui instanceof InventoryEffectRenderer) {
     if (!ClientProxy.tconstructEnabled
         || FMLClientHandler.instance().getClientPlayerEntity().capabilities.isCreativeMode) {
       onOpenGui(
           event.buttonList,
           ((InventoryEffectRenderer) event.gui).guiLeft - 30,
           ((InventoryEffectRenderer) event.gui).guiTop);
     }
   }
 }
Beispiel #11
0
  @SideOnly(Side.CLIENT)
  public static EntityPlayerSP getPlayerBaseClientFromPlayer(
      EntityPlayer player, boolean ignoreCase) {
    EntityPlayerSP clientPlayer = FMLClientHandler.instance().getClientPlayerEntity();

    if (clientPlayer == null && player != null) {
      GCLog.severe(
          "Warning: Could not find player base client instance for player "
              + player.getGameProfile().getName());
    }

    return clientPlayer;
  }
  @SubscribeEvent
  @SideOnly(Side.CLIENT)
  public void onKeyPressed(ClientTickEvent e) {
    if (e.phase == e.phase.END) {
      if (KeyHandler.CharacterKey.isKeyDown()) {
      } else if (KeyHandler.EnterVehicleKey.isPressed()) {
        if (getClosestEntity() != null) {
          EntityVehicle v = getClosestEntity();
        }
      }

      if (KeyHandler.PhoneKey.isPressed()) {
        Minecraft.getMinecraft().displayGuiScreen(new GuiPhone());
      }

      if (KeyHandler.RLMMenu.isPressed()) {
        Minecraft.getMinecraft().displayGuiScreen(new RLMMenu());
      }

      Minecraft mc = Minecraft.getMinecraft();
      if (FMLClientHandler.instance().isGUIOpen(GuiChat.class) || mc.currentScreen != null) return;

      EntityPlayer player = Minecraft.getMinecraft().thePlayer;
      Entity ridingEntity = player.ridingEntity;

      if (ridingEntity instanceof IControllable) {
        IControllable riding = (IControllable) ridingEntity;

        if (mc.gameSettings.keyBindForward.isKeyDown()) riding.pressKey(0, player);

        if (mc.gameSettings.keyBindBack.isKeyDown()) riding.pressKey(1, player);

        if (mc.gameSettings.keyBindLeft.isKeyDown()) riding.pressKey(2, player);

        if (mc.gameSettings.keyBindRight.isKeyDown()) riding.pressKey(3, player);

        if (mc.gameSettings.keyBindJump.isKeyDown()) riding.pressKey(4, player);

        if (KeyHandler.downKey.isPressed()) riding.pressKey(5, player);

        if (mc.gameSettings.keyBindSneak.isKeyDown()) riding.pressKey(6, player);
      }
    }
  }
Beispiel #13
0
  @SideOnly(Side.CLIENT)
  public static GameProfile makeOtherPlayerProfile(String strName, String strUUID) {
    GameProfile profile = null;
    for (Object e : FMLClientHandler.instance().getWorldClient().getLoadedEntityList()) {
      if (e instanceof AbstractClientPlayer) {
        GameProfile gp2 = ((AbstractClientPlayer) e).getGameProfile();
        if (gp2.getName().equals(strName)) {
          profile = gp2;
          break;
        }
      }
    }
    if (profile == null) {
      UUID uuid = strUUID.isEmpty() ? UUID.randomUUID() : UUID.fromString(strUUID);
      profile = new GameProfile(uuid, strName);
    }

    PlayerUtil.knownSkins.put(strName, profile);
    return profile;
  }
 /** Fixes pick block */
 @SubscribeEvent(priority = EventPriority.HIGHEST)
 public void replacePickBlock(MouseEvent event) {
   if (event.buttonstate) {
     Minecraft mc = FMLClientHandler.instance().getClient();
     if (mc.thePlayer != null) {
       if (event.button - 100 == mc.gameSettings.keyBindPickBlock.getKeyCode()) {
         event.setCanceled(true);
         if (!((IBattlePlayer) mc.thePlayer).isBattlemode()) {
           boolean isCreative = mc.thePlayer.capabilities.isCreativeMode;
           ItemStack stack = getItemFromPointedAt(mc.objectMouseOver, mc.thePlayer);
           if (stack != null) {
             int k = -1;
             ItemStack temp;
             for (int slot = 0; slot < MAIN_INV; slot++) {
               temp = mc.thePlayer.inventory.getStackInSlot(slot);
               if (temp != null
                   && stack.isItemEqual(temp)
                   && ItemStack.areItemStackTagsEqual(stack, temp)) {
                 k = slot;
                 break;
               }
             }
             if (isCreative && k == -1) {
               k = mc.thePlayer.inventory.getFirstEmptyStack();
               if (k < 0 || k >= MAIN_INV) {
                 k = mc.thePlayer.inventory.currentItem;
               }
             }
             if (k >= 0 && k < MAIN_INV) {
               mc.thePlayer.inventory.currentItem = k;
               Battlegear.packetHandler.sendPacketToServer(
                   new PickBlockPacket(stack, k).generatePacket());
             }
           }
         }
       }
     }
   }
 }
Beispiel #15
0
 @Override
 public EntityPlayer getPlayer() {
   return FMLClientHandler.instance().getClient().thePlayer;
 }
  public static void renderLightRayEffects(
      double x,
      double y,
      double z,
      Color effectColor,
      long seed,
      int continuousTick,
      int dstJump,
      float scale,
      int countFancy,
      int countNormal) {
    rand.setSeed(seed);
    GL11.glPushMatrix();
    GL11.glTranslated(x, y, z);

    int fancy_count =
        !FMLClientHandler.instance().getClient().gameSettings.fancyGraphics
            ? countNormal
            : countFancy;

    Tessellator tes = Tessellator.getInstance();
    VertexBuffer vb = tes.getBuffer();

    RenderHelper.disableStandardItemLighting();
    float f1 = continuousTick / 400.0F;
    float f2 = 0.4F;

    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glDepthMask(false);
    GL11.glPushMatrix();
    for (int i = 0; i < fancy_count; i++) {
      GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 0.0F, 1.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 1.0F, 0.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F, 0.0F, 1.0F, 0.0F);
      GL11.glRotatef(rand.nextFloat() * 360.0F + f1 * 360.0F, 0.0F, 0.0F, 1.0F);
      vb.begin(GL11.GL_TRIANGLE_FAN, DefaultVertexFormats.POSITION_COLOR);
      float fa = rand.nextFloat() * 20.0F + 5.0F + f2 * 10.0F;
      float f4 = rand.nextFloat() * 2.0F + 1.0F + f2 * 2.0F;
      fa /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F);
      f4 /= 30.0F / (Math.min(dstJump, 10 * scale) / 10.0F);
      vb.pos(0, 0, 0)
          .color(
              effectColor.getRed(),
              effectColor.getGreen(),
              effectColor.getBlue(),
              (int) (255.0F * (1.0F - f2)))
          .endVertex();
      vb.pos(-0.7D * f4, fa, -0.5F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      vb.pos(0.7D * f4, fa, -0.5F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      vb.pos(0.0D, fa, 1.0F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      vb.pos(-0.7D * f4, fa, -0.5F * f4)
          .color(effectColor.getRed(), effectColor.getGreen(), effectColor.getBlue(), 0)
          .endVertex();
      tes.draw();
    }
    GL11.glPopMatrix();
    GL11.glDepthMask(true);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    RenderHelper.enableStandardItemLighting();

    GL11.glPopMatrix();
  }
  @Override
  public void onLivingUpdatePost(EntityPlayerSP player) {
    GCPlayerStatsClient stats = GCPlayerStatsClient.get(player);

    if (player.worldObj.provider instanceof WorldProviderOrbit) {
      ((WorldProviderOrbit) player.worldObj.provider).postVanillaMotion(player);

      if (stats.inFreefall) {
        // No limb swing
        player.limbSwing -= player.limbSwingAmount;
        player.limbSwingAmount = player.prevLimbSwingAmount;
        float adjust = Math.min(Math.abs(player.limbSwing), Math.abs(player.limbSwingAmount) / 3);
        if (player.limbSwing < 0) player.limbSwing += adjust;
        else if (player.limbSwing > 0) player.limbSwing -= adjust;
        player.limbSwingAmount *= 0.9;
      } else {
        if (stats.inFreefallLast && this.downMot2 < -0.01D) {
          stats.landingTicks = 2 - (int) (Math.min(this.downMot2, stats.downMotionLast) * 75);
          if (stats.landingTicks > 6) stats.landingTicks = 6;
        }
      }

      if (stats.landingTicks > 0) stats.landingTicks--;
    } else stats.inFreefall = false;

    boolean ridingThirdPersonEntity =
        player.ridingEntity instanceof ICameraZoomEntity
            && ((ICameraZoomEntity) player.ridingEntity).defaultThirdPerson();

    if (ridingThirdPersonEntity && !stats.lastRidingCameraZoomEntity) {
      FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = 1;
    }

    if (player.ridingEntity != null && player.ridingEntity instanceof ICameraZoomEntity) {
      stats.lastZoomed = true;
      TickHandlerClient.zoom(((ICameraZoomEntity) player.ridingEntity).getCameraZoom());
    } else if (stats.lastZoomed) {
      stats.lastZoomed = false;
      TickHandlerClient.zoom(4.0F);
    }

    stats.lastRidingCameraZoomEntity = ridingThirdPersonEntity;

    if (stats.usingParachute) {
      player.fallDistance = 0.0F;
    }

    PlayerGearData gearData = ModelPlayerGC.getGearData(player);

    stats.usingParachute = false;

    if (gearData != null) {
      stats.usingParachute = gearData.getParachute() != null;
      if (gearData.getMask() >= 0) {
        player.height = 1.9375F;
      } else {
        player.height = 1.8F;
      }
      AxisAlignedBB bounds = player.getEntityBoundingBox();
      player.setEntityBoundingBox(
          new AxisAlignedBB(
              bounds.minX,
              bounds.minY,
              bounds.minZ,
              bounds.maxX,
              bounds.minY + (double) player.height,
              bounds.maxZ));
    }

    if (stats.usingParachute && player.onGround) {
      stats.setParachute(false);
      FMLClientHandler.instance().getClient().gameSettings.thirdPersonView = stats.thirdPersonView;
    }

    if (!stats.lastUsingParachute && stats.usingParachute) {
      FMLClientHandler.instance()
          .getClient()
          .getSoundHandler()
          .playSound(
              new PositionedSoundRecord(
                  new ResourceLocation(GalacticraftCore.TEXTURE_PREFIX + "player.parachute"),
                  0.95F + player.getRNG().nextFloat() * 0.1F,
                  1.0F,
                  (float) player.posX,
                  (float) player.posY,
                  (float) player.posZ));
    }

    stats.lastUsingParachute = stats.usingParachute;
    stats.lastOnGround = player.onGround;
  }
  /** Called to update the entity's position/logic. */
  public void onUpdate() {
    super.onUpdate();

    if (aoLightValueScratchXYNN == 100) {
      setDead();
    }

    if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) {
      float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
      prevRotationYaw = rotationYaw = (float) ((Math.atan2(motionX, motionZ) * 180D) / Math.PI);
      prevRotationPitch = rotationPitch = (float) ((Math.atan2(motionY, f) * 180D) / Math.PI);
    }

    if (aoLightValueZPos) {
      Block i = worldObj.getBlockState(new BlockPos(hitX, hitY, hitZ)).getBlock();

      if (i != blockHit) {
        aoLightValueZPos = false;
        motionX *= rand.nextFloat() * 0.2F;
        motionY *= rand.nextFloat() * 0.2F;
        motionZ *= rand.nextFloat() * 0.2F;
        aoLightValueScratchXYZNNP = 0;
        aoLightValueScratchXYNN = 0;
      } else {
        aoLightValueScratchXYZNNP++;

        if (aoLightValueScratchXYZNNP == 100) {
          setDead();
        }

        return;
      }
    } else {
      aoLightValueScratchXYNN++;
    }

    Vec3 vec3d = new Vec3(posX, posY, posZ);
    Vec3 vec3d1 = new Vec3(posX + motionX, posY + motionY, posZ + motionZ);
    MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks(vec3d, vec3d1);
    vec3d = new Vec3(posX, posY, posZ);
    vec3d1 = new Vec3(posX + motionX, posY + motionY, posZ + motionZ);

    if (movingobjectposition != null) {
      vec3d1 =
          new Vec3(
              movingobjectposition.hitVec.xCoord,
              movingobjectposition.hitVec.yCoord,
              movingobjectposition.hitVec.zCoord);
    }

    Entity entity = null;
    List list =
        worldObj.getEntitiesWithinAABBExcludingEntity(
            this,
            getEntityBoundingBox().addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
    double d = 0.0D;

    for (int j = 0; j < list.size(); j++) {
      Entity entity1 = (Entity) list.get(j);

      if (!entity1.canBeCollidedWith()
          || (entity1 == shootingEntity
                  || shootingEntity != null && entity1 == shootingEntity.ridingEntity)
              && aoLightValueScratchXYNN < 5
          || aoLightValueScratchXYZNNN) {
        if (motionZ != 0.0D || !((motionX == 0.0D) & (motionY == 0.0D))) {
          continue;
        }

        setDead();
        break;
      }

      float f4 = 0.3F;
      AxisAlignedBB axisalignedbb = entity1.getEntityBoundingBox().expand(f4, f4, f4);
      MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3d, vec3d1);

      if (movingobjectposition1 == null) {
        continue;
      }

      double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);

      if (d1 < d || d == 0.0D) {
        entity = entity1;
        d = d1;
      }
    }

    if (entity != null) {
      movingobjectposition = new MovingObjectPosition(entity);
    }

    if (movingobjectposition != null) {
      if (movingobjectposition.entityHit != null) {
        if (movingobjectposition.entityHit instanceof EntityPlayer) {
          int k = damage;

          if (worldObj.getDifficulty() == EnumDifficulty.PEACEFUL) {
            k = 0;
          }

          if (worldObj.getDifficulty() == EnumDifficulty.EASY) {
            k = k / 3 + 1;
          }

          if (worldObj.getDifficulty() == EnumDifficulty.HARD) {
            k = (k * 3) / 2;
          }
        }

        if ((movingobjectposition.entityHit instanceof EntityLiving) && playerFire
            || !(movingobjectposition.entityHit instanceof CREEPSEntityFloob)
            || playerFire) {
          if (movingobjectposition.entityHit.attackEntityFrom(
              DamageSource.causeThrownDamage(this, shootingEntity), damage)) ;

          setDead();
        } else {
          setDead();
        }
      } else {
        hitX = movingobjectposition.getBlockPos().getX();
        hitY = movingobjectposition.getBlockPos().getY();
        hitZ = movingobjectposition.getBlockPos().getZ();
        blockHit = worldObj.getBlockState(new BlockPos(hitX, hitY, hitZ));
        motionX = (float) (movingobjectposition.hitVec.xCoord - posX);
        motionY = (float) (movingobjectposition.hitVec.yCoord - posY);
        motionZ = (float) (movingobjectposition.hitVec.zCoord - posZ);
        float f1 =
            MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
        posX -= (motionX / (double) f1) * 0.05000000074505806D;
        posY -= (motionY / (double) f1) * 0.05000000074505806D;
        posZ -= (motionZ / (double) f1) * 0.05000000074505806D;
        aoLightValueZPos = true;
        setDead();

        if (CREEPSConfig.rayGunMelt
            && rand.nextInt(5) == 0
            && worldObj.getBlockState(new BlockPos(hitX, hitY, hitZ)).getBlock()
                != Blocks.bedrock) {
          if (CREEPSConfig.rayGunFire) {
            worldObj.setBlockState(new BlockPos(hitX, hitY, hitZ), Blocks.fire.getDefaultState());
          } else {
            worldObj.setBlockToAir(new BlockPos(hitX, hitY, hitZ));
          }
        }

        if (blockHit == Blocks.ice.getDefaultState()) {
          worldObj.setBlockState(
              new BlockPos(hitX, hitY, hitZ), Blocks.flowing_water.getDefaultState());
        }

        if (CREEPSConfig.rayGunFire && blockHit == Blocks.glass.getDefaultState()) {
          Side side = FMLCommonHandler.instance().getSide();
          worldObj.setBlockToAir(new BlockPos(hitX, hitY, hitZ));
          if (side == Side.CLIENT) {
            FMLClientHandler.instance()
                .getClient()
                .effectRenderer
                .func_180533_a(new BlockPos(hitX, hitY, hitZ), Blocks.glass.getDefaultState());
          }
        }

        setDead();
      }

      worldObj.playSoundAtEntity(
          this, "morecreeps:raygun", 0.2F, 1.0F / (rand.nextFloat() * 0.1F + 0.95F));
      setDead();
    }

    posX += motionX;
    posY += motionY;
    posZ += motionZ;
    float f2 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
    rotationYaw = (float) ((Math.atan2(motionX, motionZ) * 180D) / Math.PI);

    for (rotationPitch = (float) ((Math.atan2(motionY, f2) * 180D) / Math.PI);
        rotationPitch - prevRotationPitch < -180F;
        prevRotationPitch -= 360F) {}

    for (; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) {}

    for (; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) {}

    for (; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) {}

    rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
    rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
    float f3 = 0.99F;
    float f5 = 0.0F;

    if (handleWaterMovement()) {
      for (int l = 0; l < 4; l++) {
        float f7 = 0.25F;
        worldObj.spawnParticle(
            EnumParticleTypes.WATER_BUBBLE,
            posX - motionX * (double) f7,
            posY - motionY * (double) f7,
            posZ - motionZ * (double) f7,
            motionX,
            motionY,
            motionZ,
            new int[0]);
      }

      f3 = 0.8F;
      float f6 = 0.03F;
      setDead();
    }

    motionX *= f3;
    motionZ *= f3;
    setPosition(posX, posY, posZ);
  }
  @Override
  public void decodePacketdata(ByteBuf buffer) {
    super.decodePacketdata(buffer);
    this.fuelTank.setFluid(new FluidStack(GCFluids.fluidFuel, buffer.readInt()));
    this.landing = buffer.readBoolean();
    this.destinationFrequency = buffer.readInt();

    if (buffer.readBoolean()) {
      this.targetVec = new BlockPos(buffer.readInt(), buffer.readInt(), buffer.readInt());
    }

    this.motionX = buffer.readDouble() / 8000.0D;
    this.motionY = buffer.readDouble() / 8000.0D;
    this.motionZ = buffer.readDouble() / 8000.0D;
    this.lastMotionY = buffer.readDouble() / 8000.0D;
    this.lastLastMotionY = buffer.readDouble() / 8000.0D;

    if (this.cargoItems == null) {
      this.cargoItems = new ItemStack[this.getSizeInventory()];
    }

    this.setWaitForPlayer(buffer.readBoolean());

    this.statusMessage = ByteBufUtils.readUTF8String(buffer);
    this.statusMessage = this.statusMessage.equals("") ? null : this.statusMessage;
    this.statusMessageCooldown = buffer.readInt();
    this.lastStatusMessageCooldown = buffer.readInt();
    this.statusValid = buffer.readBoolean();

    // Update client with correct rider if needed
    if (this.worldObj.isRemote) {
      int shouldBeMountedId = buffer.readInt();
      if (this.riddenByEntity == null) {
        if (shouldBeMountedId > -1) {
          Entity e = FMLClientHandler.instance().getWorldClient().getEntityByID(shouldBeMountedId);
          if (e != null) {
            if (e.dimension != this.dimension) {
              if (e instanceof EntityPlayer) {
                e =
                    WorldUtil.forceRespawnClient(
                        this.dimension,
                        e.worldObj.getDifficulty().getDifficultyId(),
                        e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(),
                        ((EntityPlayerMP) e).theItemInWorldManager.getGameType().getID());
                e.mountEntity(this);
              }
            } else e.mountEntity(this);
          }
        }
      } else if (this.riddenByEntity.getEntityId() != shouldBeMountedId) {
        if (shouldBeMountedId == -1) {
          this.riddenByEntity.mountEntity(null);
        } else {
          Entity e = FMLClientHandler.instance().getWorldClient().getEntityByID(shouldBeMountedId);
          if (e != null) {
            if (e.dimension != this.dimension) {
              if (e instanceof EntityPlayer) {
                e =
                    WorldUtil.forceRespawnClient(
                        this.dimension,
                        e.worldObj.getDifficulty().getDifficultyId(),
                        e.worldObj.getWorldInfo().getTerrainType().getWorldTypeName(),
                        ((EntityPlayerMP) e).theItemInWorldManager.getGameType().getID());
                e.mountEntity(this);
              }
            } else e.mountEntity(this);
          }
        }
      }
    }
    this.statusColour = ByteBufUtils.readUTF8String(buffer);
    if (this.statusColour.equals("")) this.statusColour = null;
  }
  @Override
  public void registerRenderers(WeaponModConfig config) {
    RenderManager rendermanager = FMLClientHandler.instance().getClient().getRenderManager();
    // LongItemRenderer longrender = new LongItemRenderer();
    // StabItemRenderer stabrender = new StabItemRenderer();

    if (config.isEnabled("halberd")) {
      /*MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.halberdWood, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.halberdStone, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.halberdSteel, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.halberdDiamond, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.halberdGold, longrender);*/
    }

    if (config.isEnabled("knife")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityKnife.class, new RenderKnife(rendermanager));
      /*
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.knifeWood.itemID, stabrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.knifeStone.itemID, stabrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.knifeSteel.itemID, stabrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.knifeDiamond.itemID, stabrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.knifeGold.itemID, stabrender);*/
    }

    if (config.isEnabled("spear")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntitySpear.class, new RenderSpear(rendermanager));
      /*
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.spearWood, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.spearStone, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.spearSteel, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.spearDiamond, longrender);
      MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.spearGold, longrender);*/
    }

    if (config.isEnabled("javelin")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityJavelin.class, new RenderJavelin(rendermanager));
      // MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.javelin, longrender);
    }

    if (config.isEnabled("firerod")) {
      // MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.fireRod.itemID, stabrender);
    }

    if (config.isEnabled("musket")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityMusketBullet.class, new RenderMusketBullet(rendermanager));
    }
    if (config.isEnabled("crossbow")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityCrossbowBolt.class, new RenderCrossbowBolt(rendermanager));
      // MinecraftForgeClient.registerItemRenderer(BalkonsWeaponMod.crossbow.itemID, new
      // CrossbowItemRenderer());
    }
    if (config.isEnabled("blowgun")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityBlowgunDart.class, new RenderBlowgunDart(rendermanager));
    }
    if (config.isEnabled("dynamite")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityDynamite.class, new RenderDynamite(rendermanager));
    }
    if (config.isEnabled("flail")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityFlail.class, new RenderFlail(rendermanager));
    }
    if (config.isEnabled("cannon")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityCannon.class, new RenderCannon(rendermanager));
      RenderingRegistry.registerEntityRenderingHandler(
          EntityCannonBall.class, new RenderCannonBall(rendermanager));
    }
    if (config.isEnabled("blunderbuss")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityBlunderShot.class, new RenderBlunderShot(rendermanager));
    }
    if (config.isEnabled("dummy")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityDummy.class, new RenderDummy(rendermanager));
    }
    if (config.isEnabled("boomerang")) {
      RenderingRegistry.registerEntityRenderingHandler(
          EntityBoomerang.class, new RenderBoomerang(rendermanager));
    }
  }