Skip to content

Commit

Permalink
1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gliscowo committed May 9, 2024
1 parent bb34dff commit dea2e86
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 72 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//file:noinspection GradlePackageVersionRange
plugins {
id 'fabric-loom' version '1.5-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

Expand Down
12 changes: 6 additions & 6 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_base_version=1.20.3
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
loader_version=0.15.7
minecraft_base_version=1.20.5
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.11
# Mod Properties
mod_version=0.4.7
maven_group=com.glisco
archives_base_name=isometric-renders

# Dependencies
fabric_version=0.96.3+1.20.4
fabric_version=0.98.0+1.20.6

# https://maven.wispforest.io/io/wispforest/worldmesher/
worldmesher_version=0.4.5+1.20.3
Expand All @@ -21,4 +21,4 @@ worldmesher_version=0.4.5+1.20.3
exo_version=0.1.5+1.19

# https://maven.wispforest.io/io/wispforest/owo-lib/
owo_version=0.12.5+1.20.3
owo_version=0.12.8+1.20.5
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static void register(CommandDispatcher<FabricClientCommandSource> dispatc
.executes(IsorenderCommand::renderBlockWithArgument)))
.then(literal("entity")
.executes(IsorenderCommand::renderTargetedEntity)
.then(argument("entity", RegistryEntryArgumentType.registryEntry(access, RegistryKeys.ENTITY_TYPE))
.then(argument("entity", RegistryEntryReferenceArgumentType.registryEntry(access, RegistryKeys.ENTITY_TYPE))
.suggests(CLIENT_SUMMONABLE_ENTITIES)
.executes(IsorenderCommand::renderEntityWithoutNbt)
.then(argument("nbt", NbtCompoundArgumentType.nbtCompound())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class TagArgumentType implements ArgumentType<TagArgumentType.TagArgument
private final RegistryWrapper<Item> registryWrapper;

public TagArgumentType(CommandRegistryAccess registryAccess) {
this.registryWrapper = registryAccess.createWrapper(RegistryKeys.ITEM);
this.registryWrapper = registryAccess.getWrapperOrThrow(RegistryKeys.ITEM);
}

public static <S> TagArgument getTag(String name, CommandContext<S> context) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import com.glisco.isometricrenders.IsometricRenders;
import com.glisco.isometricrenders.util.AreaSelectionHelper;
import com.llamalad7.mixinextras.sugar.Local;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.render.Camera;
import net.minecraft.client.render.GameRenderer;
Expand All @@ -25,15 +26,15 @@ public class WorldRendererMixin {
private MinecraftClient client;

@Inject(method = "render", at = @At("HEAD"), cancellable = true)
public void dontRenderInScreen(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f positionMatrix, CallbackInfo ci) {
public void dontRenderInScreen(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci) {
if (!IsometricRenders.skipWorldRender) return;

IsometricRenders.skipWorldRender = false;
ci.cancel();
}

@Inject(method = "render", at = @At(value = "FIELD", target = "Lnet/minecraft/client/MinecraftClient;crosshairTarget:Lnet/minecraft/util/hit/HitResult;", opcode = Opcodes.GETFIELD, ordinal = 1))
public void drawAreaSelection(MatrixStack matrices, float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, CallbackInfo ci) {
public void drawAreaSelection(float tickDelta, long limitTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightmapTextureManager lightmapTextureManager, Matrix4f matrix4f, Matrix4f matrix4f2, CallbackInfo ci, @Local(ordinal = 0) MatrixStack matrices) {
AreaSelectionHelper.renderSelectionBox(matrices, camera);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.Sizing;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.RotationAxis;
import org.joml.Matrix4fStack;

public class DefaultPropertyBundle implements PropertyBundle {

Expand Down Expand Up @@ -63,14 +63,14 @@ public void buildGuiControls(Renderable<?> renderable, FlowLayout container) {
}

@Override
public void applyToViewMatrix(MatrixStack modelViewStack) {
public void applyToViewMatrix(Matrix4fStack modelViewStack) {
final float scale = this.scale.get() / 100f;
modelViewStack.scale(scale, scale, scale);

modelViewStack.translate(this.xOffset.get() / 26000d, this.yOffset.get() / -26000d, 0);
modelViewStack.translate(this.xOffset.get() / 26000f, this.yOffset.get() / -26000f, 0);

modelViewStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(this.slant.get()));
modelViewStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(this.rotation.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_X.rotationDegrees(this.slant.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(this.rotation.get()));

this.updateAndApplyRotationOffset(modelViewStack);
}
Expand All @@ -79,13 +79,13 @@ public float rotationOffset() {
return this.rotationOffset;
}

protected void updateAndApplyRotationOffset(MatrixStack modelViewStack) {
protected void updateAndApplyRotationOffset(Matrix4fStack modelViewStack) {
if (rotationSpeed.get() != 0) {
if (!this.rotationOffsetUpdated) {
rotationOffset += MinecraftClient.getInstance().getLastFrameDuration() * rotationSpeed.get() * .1f;
this.rotationOffsetUpdated = true;
}
modelViewStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(rotationOffset));
modelViewStack.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(rotationOffset));
} else {
rotationOffset = 0;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import com.glisco.isometricrenders.render.Renderable;
import io.wispforest.owo.ui.container.FlowLayout;
import net.minecraft.client.util.math.MatrixStack;
import org.joml.Matrix4fStack;

public interface PropertyBundle {

void buildGuiControls(Renderable<?> renderable, FlowLayout container);

void applyToViewMatrix(MatrixStack modelViewStack);
void applyToViewMatrix(Matrix4fStack modelViewStack);
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import net.minecraft.util.math.RotationAxis;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;

public class AreaRenderable extends DefaultRenderable<AreaRenderable.AreaPropertyBundle> {

Expand Down Expand Up @@ -86,14 +87,7 @@ public void emitVertices(MatrixStack matrices, VertexConsumerProvider vertexCons
var diff = Vec3d.of(mesh.startPos()).subtract(client.player.getPos());
matrices.translate(-diff.x, -diff.y + 1.65, -diff.z);

withParticleCamera(camera -> {
client.particleManager.renderParticles(matrices,
(VertexConsumerProvider.Immediate) vertexConsumers,
client.gameRenderer.getLightmapTextureManager(),
camera,
tickDelta
);
});
this.renderParticles(matrices.peek().getPositionMatrix(), tickDelta);
}

@Override
Expand Down Expand Up @@ -172,14 +166,14 @@ public void buildGuiControls(Renderable<?> renderable, FlowLayout container) {
}

@Override
public void applyToViewMatrix(MatrixStack modelViewStack) {
public void applyToViewMatrix(Matrix4fStack modelViewStack) {
final float scale = this.scale.get() / 1000f;
modelViewStack.scale(scale, scale, scale);

modelViewStack.translate(this.xOffset.get() / 2600d, this.yOffset.get() / -2600d, 0);
modelViewStack.translate(this.xOffset.get() / 2600f, this.yOffset.get() / -2600f, 0);

modelViewStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(this.slant.get()));
modelViewStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(this.rotation.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_X.rotationDegrees(this.slant.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(this.rotation.get()));

this.updateAndApplyRotationOffset(modelViewStack);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;

import java.util.List;

Expand Down Expand Up @@ -166,7 +167,7 @@ public void buildGuiControls(Renderable<?> renderable, FlowLayout container) {
}

@Override
public void applyToViewMatrix(MatrixStack modelViewStack) {
public void applyToViewMatrix(Matrix4fStack modelViewStack) {
this.delegate.applyToViewMatrix(modelViewStack);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public static BlockStateRenderable of(BlockState state, @Nullable NbtCompound nb
public static BlockStateRenderable copyOf(World world, BlockPos pos) {
final var state = world.getBlockState(pos);
final var data = world.getBlockEntity(pos) != null
? world.getBlockEntity(pos).createNbt()
? world.getBlockEntity(pos).createNbt(world.getRegistryManager())
: null;

return of(state, data);
Expand All @@ -79,15 +79,7 @@ public void emitVertices(MatrixStack matrices, VertexConsumerProvider vertexCons
if (zOffset < 0) zOffset += 1;

matrices.translate(xOffset, 1.65 + this.client.player.getY() % 1d, zOffset);

withParticleCamera(camera -> {
this.client.particleManager.renderParticles(matrices,
(VertexConsumerProvider.Immediate) vertexConsumers,
this.client.gameRenderer.getLightmapTextureManager(),
camera,
tickDelta
);
});
this.renderParticles(matrices.peek().getPositionMatrix(), tickDelta);

matrices.pop();
}
Expand Down Expand Up @@ -139,6 +131,6 @@ private static void prepareBlockEntity(BlockState state, BlockEntity blockEntity
nbtCopy.putInt("y", 0);
nbtCopy.putInt("z", 0);

blockEntity.readNbt(nbtCopy);
blockEntity.read(nbtCopy, MinecraftClient.getInstance().world.getRegistryManager());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,25 @@ public void draw(Matrix4f modelViewMatrix) {
MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers().draw();
}

protected void renderParticles(Matrix4f transform, float tickDelta) {
var modelView = RenderSystem.getModelViewStack();
modelView.pushMatrix();
modelView.mul(transform);
RenderSystem.applyModelViewMatrix();

var client = MinecraftClient.getInstance();
this.withParticleCamera(camera -> {
client.particleManager.renderParticles(
client.gameRenderer.getLightmapTextureManager(),
camera,
tickDelta
);
});

modelView.popMatrix();
RenderSystem.applyModelViewMatrix();
}

protected void withParticleCamera(Consumer<Camera> action) {
Camera camera = MinecraftClient.getInstance().getEntityRenderDispatcher().camera;
float previousYaw = camera.getYaw(), previousPitch = camera.getPitch();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.util.math.MatrixStack;
import org.joml.Matrix4f;
import org.joml.Matrix4fStack;

public class EmptyRenderable implements Renderable<PropertyBundle> {

Expand All @@ -14,7 +15,7 @@ public class EmptyRenderable implements Renderable<PropertyBundle> {
public void buildGuiControls(Renderable<?> renderable, FlowLayout container) {}

@Override
public void applyToViewMatrix(MatrixStack modelViewStack) {}
public void applyToViewMatrix(Matrix4fStack modelViewStack) {}
};

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,7 @@ public void emitVertices(MatrixStack matrices, VertexConsumerProvider vertexCons
matrices.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-180));
matrices.translate(0, 1.65, 0);

withParticleCamera(camera -> {
client.particleManager.renderParticles(matrices,
(VertexConsumerProvider.Immediate) vertexConsumers,
client.gameRenderer.getLightmapTextureManager(),
camera,
tickDelta
);
});
this.renderParticles(matrices.peek().getPositionMatrix(), tickDelta);

matrices.pop();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.RotationAxis;
import org.joml.Matrix4fStack;

import java.util.List;

Expand Down Expand Up @@ -86,10 +87,10 @@ public void buildGuiControls(Renderable<?> renderable, FlowLayout container) {
}

@Override
public void applyToViewMatrix(MatrixStack modelViewStack) {
public void applyToViewMatrix(Matrix4fStack modelViewStack) {
super.applyToViewMatrix(modelViewStack);
modelViewStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(-this.rotation.get()));
modelViewStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(-this.slant.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(-this.rotation.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_X.rotationDegrees(-this.slant.get()));
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,24 @@
import net.minecraft.item.Items;
import net.minecraft.registry.Registries;
import net.minecraft.util.math.RotationAxis;
import org.joml.Matrix4fStack;

public class ItemRenderable extends DefaultRenderable<DefaultPropertyBundle> {

private static BakedModel currentModel = null;
private static final DefaultPropertyBundle PROPERTIES = new DefaultPropertyBundle() {
@Override
public void applyToViewMatrix(MatrixStack modelViewStack) {
public void applyToViewMatrix(Matrix4fStack modelViewStack) {
final float scale = (this.scale.get() / 100f) * (currentModel != null && currentModel.hasDepth() ? 2f : 1.75f);
modelViewStack.scale(scale, scale, scale);

modelViewStack.translate(this.xOffset.get() / 26000d, this.yOffset.get() / -26000d, 0);
modelViewStack.translate(this.xOffset.get() / 26000f, this.yOffset.get() / -26000f, 0);

modelViewStack.multiply(RotationAxis.POSITIVE_X.rotationDegrees(this.slant.get()));
if (currentModel != null) currentModel.getTransformation().getTransformation(ModelTransformationMode.GUI).apply(false, modelViewStack);
modelViewStack.multiply(RotationAxis.POSITIVE_Y.rotationDegrees(this.rotation.get()));
modelViewStack.rotate(RotationAxis.POSITIVE_X.rotationDegrees(this.slant.get()));
var bruhMatrices = new MatrixStack();
if (currentModel != null) currentModel.getTransformation().getTransformation(ModelTransformationMode.GUI).apply(false, bruhMatrices);
modelViewStack.mul(bruhMatrices.peek().getPositionMatrix());
modelViewStack.rotate(RotationAxis.POSITIVE_Y.rotationDegrees(this.rotation.get()));

this.updateAndApplyRotationOffset(modelViewStack);
}
Expand Down
Loading

0 comments on commit dea2e86

Please sign in to comment.