Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/20/18 in all areas

  1. Quite a lot of objects in Minecraft are are singletons, objects where there is only one instance. IE there is only one IRON_INGOT. So instead of using Object#equals just use "==". And you shouldn't worry about comparison checks you can do millions potentially billions of them per second.
    1 point
  2. Its kinda hard when there's a lot of good mods that add a Much Needed better storage system (AE2/RS) But, Barring those because they're kinda universally just great... Immersive Engineering and its Addons are really great. Galacticraft is neat And Thaumcraft is a Really well done magic mod But boi... Ars Magica 2 brings me back to the good days.
    1 point
  3. Note: Empty bowls can be duplicated by having the food item in Slot 2-9, and having an empty slot in any slot to the left of the food item. You will eat, Sometimes it'll visually complete, You'll get an empty bowl, But you'll also get an Actual empty bowl in the empty slot. This basically allows you to eat and run at full speed.
    1 point
  4. public List<BakedQuad> colorQuads(List<BakedQuad> quads, int color) { for (int i = 0; i < quads.size(); i++) { net.minecraftforge.client.model.pipeline.LightUtil.renderQuadColor(Tessellator.getInstance().getBuffer(), quads.get(i), color); } return quads; } renderQuadColor renders the quad. It doesn't change the properties of said quad. So this would obviously do nothing to the quad. int colorRGBA = 0; colorRGBA |= 0x00 << 16;// r colorRGBA |= 0xFF << 8; // g colorRGBA |= 0x00 << 0; // b colorRGBA |= 0xFF << 24;// a renderQuadsColor(bufferbuilder, quads, colorRGBA); Or you could simply write int colorRGBA = 0xFF00FF00; And have the same effect without the bitshifts and or. As for the actual question. Quads are usually stored in the ITEM vertex format which has the color element. So you can absolutely apply color to BakedQuads. It is pretty straight forward. Each quad contains 4 vertices which each contain the elements of the format in the order specified by that format. In BakedQuads those vertices are unified into a single array: protected final int[] vertexData; This doesn't stop you from modifying the vertex data by modifying the array. So the logical order of operations would be to iterate 4 times(4 vertices per quad), get the color element in the array by multiplying the current vertex's index with the size of each vertex and adding the offset to the color element. All that data is available to you in the format of the quad. So basically you would need to create a custom BakedQuad wrapper and change what you return in the BakedQuad#getVertexData method. This might be tough to understand so here is a functional example: private static class ColoredQuad extends BakedQuad { private boolean wasRecolored; // Caching whether the recoloring occured. private int[] vertexData; // The data of the quad. // Wrapper constructor public ColoredQuad(BakedQuad original) { super(original.getVertexData(), original.getTintIndex(), original.getFace(), original.getSprite(), original.shouldApplyDiffuseLighting(), original.getFormat()); this.vertexData = original.getVertexData(); } private void recolor() { // First getting the format of the quad. VertexFormat format = this.format; // Getting the size of each vertex. int size = format.getIntegerSize(); // Getting the color offset. Dividing by 4 because the offset is specified in bytes. int offset = format.getColorOffset() / 4; // The color you want to recolor the quad to. Note that the format for the color is ABGR! int newColor = 0xFF0000FF; // Iterating over the vertices(4 vertices per quad) for (int i = 0; i < 4; i++) { // Modifying the element of the vertex at [i] at [offset] with the new color. this.vertexData[offset + size * i] = newColor; } // Caching that the operation was performed. this.wasRecolored = true; } // The vertex data getter. @Override public int[] getVertexData() { // Recolor the quad if it wasn't recolored. if (!this.wasRecolored) { this.recolor(); } return this.vertexData; } } And here is how it looks when I replace the model of the Iron Ingot with the one that colored the quads:
    1 point
  5. I have no sympathy for you players who use Netease, their entire business model is bad and abuses the hard work that we here at Forge, and other modders do. If they want to start complaining that I don't produce Forge fast enough, then they can start helping out. But no they just sit back, toss DRM onto things, and just rake it in. It'll be done when it's done.
    1 point
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.