Beispiel #1
0
 private void entityCalc() {
   synchronized (map.watchedEntities) {
     map.watchedEntities.clear();
     if (!Spoutcraft.hasPermission("spout.plugin.minimap.showentities")) {
       return;
     }
     if (!MinimapConfig.getInstance().isShowingEntities()) {
       return;
     }
     int radius = map.renderSize / 2;
     double playerX = map.getPlayerX();
     double playerZ = map.getPlayerZ();
     for (Object ob :
         SpoutClient.getHandle()
             .theWorld
             .getEntitiesWithinAABB(
                 EntityLiving.class,
                 AxisAlignedBB.getBoundingBox(
                     playerX - radius,
                     0,
                     playerZ - radius,
                     playerX + radius,
                     256,
                     playerZ + radius))) {
       net.minecraft.src.Entity e = (net.minecraft.src.Entity) ob;
       if (!MinimapConfig.getInstance().isEntityVisible(e.getClass())) {
         continue;
       }
       WatchedEntity w = new WatchedEntity(e);
       if (w.getTexture() != null) {
         map.watchedEntities.add(w);
       }
     }
   }
 }
Beispiel #2
0
 public static void drawGradientRectangle(
     int x, int y, int gradientX, int gradientY, int colorOne, int colorTwo) {
   float alphaOne = (float) (colorOne >> 24 & 255) / 255.0F;
   float redOne = (float) (colorOne >> 16 & 255) / 255.0F;
   float greenOne = (float) (colorOne >> 8 & 255) / 255.0F;
   float blueOne = (float) (colorOne & 255) / 255.0F;
   float alphaTwo = (float) (colorTwo >> 24 & 255) / 255.0F;
   float redTwo = (float) (colorTwo >> 16 & 255) / 255.0F;
   float greenTwo = (float) (colorTwo >> 8 & 255) / 255.0F;
   float blueTwo = (float) (colorTwo & 255) / 255.0F;
   GL11.glDisable(GL11.GL_TEXTURE_2D);
   GL11.glEnable(GL11.GL_BLEND);
   GL11.glDisable(GL11.GL_ALPHA_TEST);
   GL11.glBlendFunc(770, 771);
   GL11.glShadeModel(GL11.GL_SMOOTH);
   MinecraftTessellator tessellator = Spoutcraft.getTessellator();
   tessellator.startDrawingQuads();
   tessellator.setColorRGBAFloat(redOne, greenOne, blueOne, alphaOne);
   tessellator.addVertex((double) gradientX, (double) y, 0.0D);
   tessellator.addVertex((double) x, (double) y, 0.0D);
   tessellator.setColorRGBAFloat(redTwo, greenTwo, blueTwo, alphaTwo);
   tessellator.addVertex((double) x, (double) gradientY, 0.0D);
   tessellator.addVertex((double) gradientX, (double) gradientY, 0.0D);
   tessellator.draw();
   GL11.glShadeModel(GL11.GL_FLAT);
   GL11.glDisable(GL11.GL_BLEND);
   GL11.glEnable(GL11.GL_ALPHA_TEST);
   GL11.glEnable(GL11.GL_TEXTURE_2D);
 }
Beispiel #3
0
  public static void drawRectangle(int x, int y, int width, int height, int color) {
    int temp;
    if (x < width) {
      temp = x;
      x = width;
      width = temp;
    }

    if (y < height) {
      temp = y;
      y = height;
      height = temp;
    }

    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glBlendFunc(770, 771);
    GL11.glColor4f(red, green, blue, alpha);
    MinecraftTessellator tessellator = Spoutcraft.getTessellator();
    tessellator.startDrawingQuads();
    tessellator.addVertex((double) x, (double) height, 0.0D);
    tessellator.addVertex((double) width, (double) height, 0.0D);
    tessellator.addVertex((double) width, (double) y, 0.0D);
    tessellator.addVertex((double) x, (double) y, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
  }
Beispiel #4
0
 public static void drawTexturedModalRectangle(
     int x, int y, int var3, int modalX, int modalY, int modalZ, float zLevel) {
   float var7 = 0.00390625F;
   float var8 = 0.00390625F;
   MinecraftTessellator tessellator = Spoutcraft.getTessellator();
   tessellator.startDrawingQuads();
   tessellator.addVertexWithUV(
       (double) x,
       (double) (y + modalZ),
       (double) zLevel,
       (double) ((float) (var3) * var7),
       (double) ((float) (modalX + modalZ) * var8));
   tessellator.addVertexWithUV(
       (double) (x + modalY),
       (double) (y + modalZ),
       (double) zLevel,
       (double) ((float) (var3 + modalY) * var7),
       (double) ((float) (modalX + modalZ) * var8));
   tessellator.addVertexWithUV(
       (double) (x + modalY),
       (double) (y),
       (double) zLevel,
       (double) ((float) (var3 + modalY) * var7),
       (double) ((float) (modalX) * var8));
   tessellator.addVertexWithUV(
       (double) x,
       (double) y,
       (double) zLevel,
       (double) ((float) (var3) * var7),
       (double) ((float) (modalX) * var8));
   tessellator.draw();
 }
Beispiel #5
0
  public static SpoutClient getInstance() {
    if (instance == null) {
      new SpoutClient();
      Spoutcraft.setClient(instance);

      // Must be done after construtor
      ServerAddon addon = new ServerAddon("Spoutcraft", version, null);
      instance.addonManager.addFakeAddon(addon);

      System.out.println("Available Memory: " + Runtime.getRuntime().maxMemory() + " mb");
    }
    return instance;
  }
  // Don't call this method, for future use.
  protected Texture getTextureFromCoords(World world, int x, int y, int z) {
    short customId = 0;
    Texture texture = null;
    if (SpoutClient.getInstance().getRawWorld() != null) {
      SpoutcraftChunk sChunk =
          Spoutcraft.getChunkAt(SpoutClient.getInstance().getRawWorld(), x, y, z);
      customId = sChunk.getCustomBlockId(x, y, z);
      short[] customBlockIds = sChunk.getCustomBlockIds();
      byte[] customBlockData = sChunk.getCustomBlockData();

      if (customId > 0) {
        CustomBlock block = MaterialData.getCustomBlock(customId);
        if (block != null) {
          BlockDesign design = block.getBlockDesign(customBlockData[customId]);
          if (design != null) {
            texture = getTextureFromUrl(block.getAddon(), design.getTextureURL());
          }
        }
      }
    }
    return texture;
  }
  @Override
  public void initGui() {
    Control control;

    GenericScrollArea screen = new GenericScrollArea();
    scroll = screen;
    screen.setHeight(height - 24 - 30).setWidth(width).setY(24).setX(0);
    getScreen().attachWidget("Spoutcraft", screen);

    GenericLabel label = new GenericLabel("Game Settings");
    int size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(10);
    label.setFixed(true).setPriority(RenderPriority.Lowest);
    getScreen().attachWidget("Spoutcraft", label);

    int left = (int) (width / 2 - 155);
    int right = (int) (width / 2 + 5);
    int center = (int) (width / 2 - 75);

    control = new ResetButton(parent).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(height - 25);
    getScreen().attachWidget("Spoutcraft", control);

    switchToAdvancedCheck = new GenericCheckBox("Advanced");
    switchToAdvancedCheck.setChecked(false);
    switchToAdvancedCheck.setX(5).setY(3).setWidth(100).setHeight(20);
    switchToAdvancedCheck.setPriority(RenderPriority.Low);
    getScreen().attachWidget("Spoutcraft", switchToAdvancedCheck);

    doneButton = new GenericButton("Done");
    doneButton.setAlign(WidgetAnchor.CENTER_CENTER);
    doneButton.setX(right).setY(height - 25);
    doneButton.setHeight(20).setWidth(150);
    getScreen().attachWidget("Spoutcraft", doneButton);

    int top = 5;

    Color grey = new Color(0.80F, 0.80F, 0.80F, 0.65F);

    label = new GenericLabel("Controls and Audio Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    Gradient linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width / 2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    control = new MusicSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new SoundEffectsSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new FieldOfViewSlider().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new DifficultyButton().setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new TexturesButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(center).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ControlsButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new LanguagesButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);
    top += 22;

    control = new ChatButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(left).setY(top);
    screen.attachWidget("Spoutcraft", control);

    control = new MinimapButton(this).setAlign(WidgetAnchor.TOP_CENTER);
    control.setWidth(150).setHeight(20).setX(right).setY(top);
    screen.attachWidget("Spoutcraft", control);

    top += 22;

    // Graphics
    label = new GenericLabel("Graphical Settings");
    size = Spoutcraft.getMinecraftFont().getTextWidth(label.getText());
    label.setX((int) (width / 2 - size / 2)).setY(top);
    label.setTextColor(grey);
    screen.attachWidget("Spoutcraft", label);
    top += 11;

    linebreak = new GenericGradient();
    linebreak.setBottomColor(grey);
    linebreak.setTopColor(grey);
    linebreak.setX(width / 2 - 318 / 2).setY(top).setHeight(3).setWidth(318);
    screen.attachWidget("Spoutcraft", linebreak);
    top += 6;

    // TODO Clean up references to Spoutworth and remove message
    Label message = new GenericLabel("");
    message.setWidth(150).setHeight(20).setX(left).setY(top);

    if (Configuration.isAutomatePerformance()) {
      screen.attachWidget("Spoutcraft", message);

      // top += 47;
    }

    RadioButton button;
    button =
        (RadioButton)
            new FavorPerformanceButton("Favor Performance", message)
                .setGroup(1)
                .setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(left).setY(top);
    button.setTooltip(
        "Spoutcraft will attempt to provide smooth framerates, potentially at the cost of appearance.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(
        Configuration.isAutomatePerformance() && Configuration.getAutomateMode() == 0);

    button =
        (RadioButton)
            new OptimalGameplayButton("Balanced Gameplay", message)
                .setGroup(1)
                .setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(right).setY(top);
    button.setTooltip("Spoutcraft will attempt to provide reasonable framerates and appearance.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(
        Configuration.isAutomatePerformance() && Configuration.getAutomateMode() == 1);

    top += 22;

    button =
        (RadioButton)
            new FavorAppearanceButton("Favor Appearance", message)
                .setGroup(1)
                .setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(left).setY(top);
    button.setTooltip(
        "Spoutcraft will attempt to provide the best appearance, but potentially at the cost of framerates.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(
        Configuration.isAutomatePerformance() && Configuration.getAutomateMode() == 2);

    button =
        (RadioButton)
            new ManualSelectionButton("Manual Selection", message, parent)
                .setGroup(1)
                .setAlign(WidgetAnchor.TOP_CENTER);
    button.setWidth(150).setHeight(20).setX(right).setY(top);
    button.setTooltip("Disable automatic performance settings and adjust the settings manually.");
    screen.attachWidget("Spoutcraft", button);
    button.setSelected(!Configuration.isAutomatePerformance());

    top += 22;
    // TODO add option controls to the scroll area
  }
Beispiel #8
0
 public void render() {
   Spoutcraft.getClient().getRenderDelegate().render(this);
 }
 private double getScreenHeight() {
   if (getScreen() == null) {
     return Spoutcraft.getRenderDelegate().getScreenHeight();
   }
   return getScreen().getHeight();
 }