Skip to content

Commit 25722db

Browse files
committed
Fix Antiblock model issues. Change mods.toml versions.
1 parent cf8ecfd commit 25722db

File tree

6 files changed

+18
-72
lines changed

6 files changed

+18
-72
lines changed

src/generated/resources/.cache/e2d46d9f5656df0076f660c33d8ed99d544c0647

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/generated/resources/assets/rgbblocks/models/block/antiblock.json

+1-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/java/platinpython/rgbblocks/client/model/AntiblockBakedModel.java

+5-57
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
import com.google.common.collect.Sets;
77
import com.google.gson.JsonDeserializationContext;
88
import com.google.gson.JsonObject;
9-
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
10-
import com.mojang.blaze3d.vertex.VertexFormatElement;
119
import com.mojang.datafixers.util.Pair;
1210
import net.minecraft.client.Minecraft;
1311
import net.minecraft.client.renderer.RenderType;
@@ -31,6 +29,7 @@
3129
import net.minecraft.world.level.block.Blocks;
3230
import net.minecraft.world.level.block.entity.BlockEntity;
3331
import net.minecraft.world.level.block.state.BlockState;
32+
import net.minecraftforge.client.ChunkRenderTypeSet;
3433
import net.minecraftforge.client.model.IQuadTransformer;
3534
import net.minecraftforge.client.model.data.ModelData;
3635
import net.minecraftforge.client.model.data.ModelProperty;
@@ -492,16 +491,10 @@ public ItemOverrides getOverrides() {
492491
return base.getOverrides();
493492
}
494493

495-
private static int findElementIndex(VertexFormatElement element) {
496-
List<VertexFormatElement> elements = DefaultVertexFormat.BLOCK.getElements();
497-
for (int i = 0; i < elements.size(); i++) {
498-
VertexFormatElement elem = elements.get(i);
499-
if (elem == element) {
500-
return i;
501-
}
502-
}
503-
throw new IllegalArgumentException(
504-
String.format("VertexFormat %s doesn't have element %s", DefaultVertexFormat.BLOCK, element));
494+
@Override
495+
public ChunkRenderTypeSet getRenderTypes(@NotNull BlockState state, @NotNull RandomSource rand,
496+
@NotNull ModelData data) {
497+
return base.getRenderTypes(state, rand, data);
505498
}
506499

507500
public static void unpackPosition(int[] vertexData, float[] pos, int vert) {
@@ -517,33 +510,6 @@ public static void unpackUV(int[] vertexData, float[] uv, int vert) {
517510
uv[1] = Float.intBitsToFloat(vertexData[offset + 1]);
518511
}
519512

520-
public static void unpackNormals(int[] vertexData, float[] normal, int vert) {
521-
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.NORMAL;
522-
int packedNormal = vertexData[offset];
523-
524-
normal[0] = ((byte) (packedNormal & 0xFF)) / 127F;
525-
normal[1] = ((byte) ((packedNormal >> 8) & 0xFF)) / 127F;
526-
normal[2] = ((byte) ((packedNormal >> 16) & 0xFF)) / 127F;
527-
}
528-
529-
public static void unpackColor(int[] vertexData, int[] color, int vert) {
530-
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.COLOR;
531-
int packedColor = vertexData[offset];
532-
533-
color[0] = packedColor & 0xFF;
534-
color[1] = (packedColor >> 8) & 0xFF;
535-
color[2] = (packedColor >> 16) & 0xFF;
536-
color[3] = (packedColor >> 24) & 0xFF;
537-
}
538-
539-
public static void unpackLight(int[] vertexData, int[] light, int vert) {
540-
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.UV2;
541-
int packedLight = vertexData[offset];
542-
543-
light[0] = packedLight & 0xFFFF;
544-
light[1] = (packedLight >> 16) & 0xFFFF;
545-
}
546-
547513
public static void packPosition(float[] pos, int[] vertexData, int vert) {
548514
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.POSITION;
549515
vertexData[offset] = Float.floatToRawIntBits(pos[0]);
@@ -557,24 +523,6 @@ public static void packUV(float[] uv, int[] vertexData, int vert) {
557523
vertexData[offset + 1] = Float.floatToRawIntBits(uv[1]);
558524
}
559525

560-
public static void packNormals(float[] normal, int[] vertexData, int vert) {
561-
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.NORMAL;
562-
563-
int packedNormal = vertexData[offset];
564-
vertexData[offset] = (((byte) (normal[0] * 127F)) & 0xFF) | ((((byte) (normal[1] * 127F)) & 0xFF) << 8) | ((((byte) (normal[2] * 127F)) & 0xFF) << 16) | (packedNormal & 0xFF000000);
565-
}
566-
567-
public static void packColor(int[] color, int[] vertexData, int vert) {
568-
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.COLOR;
569-
570-
vertexData[offset] = (color[0] & 0xFF) | ((color[1] & 0xFF) << 8) | ((color[2] & 0xFF) << 16) | ((color[3] & 0xFF) << 24);
571-
}
572-
573-
public static void packLight(int[] light, int[] vertexData, int vert) {
574-
int offset = vert * IQuadTransformer.STRIDE + IQuadTransformer.UV2;
575-
vertexData[offset] = (light[0] & 0xFFFF) | ((light[1] & 0xFFFF) << 16);
576-
}
577-
578526
public record Connections(Direction side, boolean up, boolean down, boolean left, boolean right, boolean upLeft,
579527
boolean upRight, boolean downLeft, boolean downRight) {
580528
public boolean isClosed() {

src/main/java/platinpython/rgbblocks/data/ModBlockStateProvider.java

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ public JsonObject toJson(JsonObject json) {
8484
models().withExistingParent(BlockRegistry.RGB_ANTIBLOCK.getId().getPath(),
8585
new ResourceLocation("forge:block/default")
8686
)
87-
.renderType("cutout")
8887
.customLoader(AntiblockLoaderBuilder::new)
8988
.baseModel(models().singleTexture(BlockRegistry.RGB_ANTIBLOCK.getId().getPath() + "_base",
9089
modLoc(ModelProvider.BLOCK_FOLDER + "/no_shade_2_layer"),

src/main/resources/META-INF/mods.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,13 @@ issueTrackerURL="https://github.com/PlatinPython/RGBBlocks/issues"
1717
[[dependencies.rgbblocks]]
1818
modId="forge"
1919
mandatory=true
20-
versionRange="[40,)"
20+
versionRange="[43,)"
2121
ordering="NONE"
2222
side="BOTH"
2323

2424
[[dependencies.rgbblocks]]
2525
modId="minecraft"
2626
mandatory=true
27-
versionRange="[1.18.2,)"
27+
versionRange="[1.19.2,)"
2828
ordering="NONE"
2929
side="BOTH"

src/main/resources/assets/rgbblocks/models/block/no_shade_2_layer.json

+8-8
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
}
1919
},
2020
{
21-
"from": [-0.01, -0.01, -0.01],
22-
"to": [16.01, 16.01, 16.01],
21+
"from": [0, 0, 0],
22+
"to": [16, 16, 16],
2323
"shade": false,
2424
"faces": {
25-
"north": {"uv": [-0.01, -0.01, 16.01, 16.01], "texture": "#top", "cullface": "north"},
26-
"east": {"uv": [-0.01, -0.01, 16.01, 16.01], "texture": "#top", "cullface": "east"},
27-
"south": {"uv": [-0.01, -0.01, 16.01, 16.01], "texture": "#top", "cullface": "south"},
28-
"west": {"uv": [-0.01, -0.01, 16.01, 16.01], "texture": "#top", "cullface": "west"},
29-
"up": {"uv": [-0.01, -0.01, 16.01, 16.01], "texture": "#top", "cullface": "up"},
30-
"down": {"uv": [-0.01, -0.01, 16.01, 16.01], "texture": "#top", "cullface": "down"}
25+
"north": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "north"},
26+
"east": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "east"},
27+
"south": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "south"},
28+
"west": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "west"},
29+
"up": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "up"},
30+
"down": {"uv": [0, 0, 16, 16], "texture": "#top", "cullface": "down"}
3131
}
3232
}
3333
],

0 commit comments

Comments
 (0)