Skip to content

Commit

Permalink
Update to 1.19/Sodium 0.4.2 (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMS authored Jun 8, 2022
1 parent f2f123c commit 91eb1b1
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 19 deletions.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '0.11-SNAPSHOT'
id 'fabric-loom' version '0.12-SNAPSHOT'
id 'maven-publish'

id 'org.ajoberstar.grgit' version '4.1.0'
Expand Down Expand Up @@ -43,7 +43,7 @@ dependencies {
// PSA: Some older mods, compiled on Loom 0.2.1, might have outdated Maven POMs.
// You may need to force-disable transitiveness on them.

modImplementation "maven.modrinth:sodium:mc1.18.2-0.4.1"
modImplementation "maven.modrinth:sodium:mc1.19-0.4.2"

// Transitive dependency of Sodium
implementation("org.joml:joml:1.10.2")
Expand Down
10 changes: 5 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://modmuss50.me/fabric.html
minecraft_version=1.18.2
yarn_mappings=1.18.2+build.3
loader_version=0.13.3
minecraft_version=1.19
yarn_mappings=1.19+build.1
loader_version=0.14.6
# Mod Properties
mod_version=1.0.3
mod_version=1.0.4
maven_group=link.infra
archives_base_name=indium
# Dependencies
# check this on https://modmuss50.me/fabric.html
fabric_version=0.51.1+1.18.2
fabric_version=0.55.2+1.19
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@
package link.infra.indium.mixin.renderer;

import java.util.BitSet;
import java.util.Random;


import net.minecraft.util.math.random.Random;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
Expand Down Expand Up @@ -49,12 +50,14 @@ public abstract class MixinBlockModelRenderer implements AccessBlockModelRendere
@Shadow
protected abstract void getQuadDimensions(BlockRenderView blockView, BlockState blockState, BlockPos blockPos, int[] vertexData, Direction face, float[] aoData, BitSet controlBits);

@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLjava/util/Random;JI)Z", cancellable = true)
private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean checkSides, Random rand, long seed, int overlay, CallbackInfoReturnable<Boolean> ci) {
@Inject(at = @At("HEAD"), method = "render(Lnet/minecraft/world/BlockRenderView;Lnet/minecraft/client/render/model/BakedModel;Lnet/minecraft/block/BlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;ZLnet/minecraft/util/math/random/Random;JI)V", cancellable = true)
private void hookRender(BlockRenderView blockView, BakedModel model, BlockState state, BlockPos pos, MatrixStack matrix, VertexConsumer buffer, boolean cull, Random rand, long seed, int overlay, CallbackInfo ci) {
if (!((FabricBakedModel) model).isVanillaAdapter()) {
BlockRenderContext context = indium_contexts.get();
// Note that we do not support face-culling here (so checkSides is ignored)
ci.setReturnValue(context.render(blockView, model, state, pos, matrix, buffer, rand, seed, overlay));

context.render(blockView, model, state, pos, matrix, buffer, rand, seed, overlay);
ci.cancel();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@
import net.minecraft.client.render.model.BakedModel;
import net.minecraft.client.render.model.BakedQuad;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;

import java.util.List;
import java.util.Random;

import java.util.function.Consumer;
import java.util.function.Supplier;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

package link.infra.indium.renderer.render;

import java.util.Random;

import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
Expand All @@ -33,6 +33,7 @@
import net.minecraft.util.math.Matrix3f;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView;

import net.fabricmc.fabric.api.renderer.v1.mesh.Mesh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@
import net.minecraft.client.render.RenderLayers;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.random.Random;
import net.minecraft.world.BlockRenderView;

import java.util.Random;

import java.util.function.Supplier;

/**
Expand All @@ -40,7 +41,7 @@
public class BlockRenderInfo {
private final BlockColors blockColorMap = MinecraftClient.getInstance().getBlockColors();
protected BlockOcclusionCache blockOcclusionCache;
public final Random random = new Random();
public final Random random = Random.create();
public BlockRenderView blockView;
public BlockPos blockPos;
public BlockState blockState;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.Direction;
import net.minecraft.util.math.Vec3f;
import net.minecraft.util.math.random.Random;

import java.util.List;
import java.util.Random;

import java.util.function.Consumer;
import java.util.function.Supplier;

Expand All @@ -62,7 +63,7 @@ public interface VanillaQuadHandler {
}

private final ItemColors colorMap;
private final Random random = new Random();
private final Random random = Random.create();
private final Vec3f normalVec = new Vec3f();

private final Supplier<Random> randomSupplier = () -> {
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
],
"depends": {
"fabricloader": ">=0.8.0",
"minecraft": "~1.18.2",
"sodium": "0.4.1",
"minecraft": "~1.19",
"sodium": "0.4.2",
"fabric-renderer-api-v1": ">=0.3.0",
"fabric-resource-loader-v0": ">=0.4.0"
}
Expand Down

0 comments on commit 91eb1b1

Please sign in to comment.