Skip to content

Commit

Permalink
update for 1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
sisby-folk committed Jan 13, 2025
1 parent 72be735 commit 006ac02
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import folk.sisby.antique_atlas.WorldAtlasData;
import folk.sisby.antique_atlas.gui.AtlasScreen;
import folk.sisby.antique_atlas.gui.tiles.TileRenderIterator;
import folk.sisby.antique_atlas.util.ColorUtil;
import folk.sisby.antique_atlas.util.DrawBatcher;
import folk.sisby.antique_atlas.util.DrawUtil;
import folk.sisby.antique_atlas.util.MathUtil;
Expand Down Expand Up @@ -103,7 +104,7 @@ void renderFirstPersonAtlas(MatrixStack matrices, VertexConsumerProvider vertexC
DyeColor color = landmark.color();
Vector2d markerPoint = new Vector2d(markerX, markerY);
float alpha = (float) MathHelper.clamp(MathUtil.innerDistanceToEdge(mapArea, markerPoint) / 32.0, 0, 1);
texture.draw(matrices, vertexConsumers, markerX, markerY, 1, tileChunks, color == null ? null : color.getColorComponents(), 1F, alpha, light);
texture.draw(matrices, vertexConsumers, markerX, markerY, 1, tileChunks, color == null ? null : ColorUtil.getColorFromArgb(color.getEntityColor()), 1F, alpha, light);
});
matrices.pop();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@

@Mixin(ModelLoader.class)
public abstract class MixinModelLoader {
@Shadow protected abstract void addModel(ModelIdentifier modelId);
@Shadow protected abstract void loadInventoryVariantItemModel(Identifier id);

@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Ljava/util/Map;values()Ljava/util/Collection;"))
private void loadAtlasModel(BlockColors blockColors, Profiler profiler, Map<Identifier, JsonUnbakedModel> jsonUnbakedModels, Map<Identifier, List<ModelLoader.SourceTrackedData>> blockStates, CallbackInfo ci) {
addModel(AntiqueAtlas.ATLAS_MODEL);
private void loadAtlasModel(BlockColors blockColors, Profiler profiler, Map<?, ?> jsonUnbakedModels, Map<?, ?> blockStates, CallbackInfo ci) {
loadInventoryVariantItemModel(AntiqueAtlas.ATLAS_MODEL.id());
}
}
6 changes: 5 additions & 1 deletion src/main/java/folk/sisby/antique_atlas/util/DrawBatcher.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.render.BufferBuilder;
import net.minecraft.client.render.BufferRenderer;
import net.minecraft.client.render.BuiltBuffer;
import net.minecraft.client.render.GameRenderer;
import net.minecraft.client.render.RenderLayer;
import net.minecraft.client.render.Tessellator;
Expand Down Expand Up @@ -57,6 +58,9 @@ private void innerAdd(int x1, int x2, int y1, int y2, int z, float u1, float u2,

@Override
public void close() {
if (bufferBuilder != null) BufferRenderer.drawWithGlobalProgram(bufferBuilder.end());
if (bufferBuilder != null) {
BuiltBuffer bb = bufferBuilder.endNullable();
if (bb != null) BufferRenderer.drawWithGlobalProgram(bb);
}
}
}

0 comments on commit 006ac02

Please sign in to comment.