Skip to content

Commit

Permalink
Updated for fabric 1.20.6
Browse files Browse the repository at this point in the history
  • Loading branch information
r8420 committed May 26, 2024
1 parent 1aa5496 commit b2ffead
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 91 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ processResources {
}

tasks.withType(JavaCompile).configureEach {
it.options.release = 17
it.options.release = 21
}

java {
Expand All @@ -85,8 +85,8 @@ java {
// If you remove this line, sources will not be generated.
withSourcesJar()

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_21
targetCompatibility = JavaVersion.VERSION_21
}

jar {
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.4
yarn_mappings=1.20.4+build.3
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.3
loader_version=0.15.11

# Fabric API
fabric_version=0.97.0+1.20.4
fabric_version=0.99.0+1.20.6

# Mod Properties
mod_version=1.22.4.2-fabric
mod_version=1.22.5.1-fabric
maven_group=at.ridgo8.moreoverlays
archives_base_name=moreoverlays

Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,6 @@ public static void renderOverlays(PoseStack matrixstack) {
RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth);
RenderSystem.setShader(GameRenderer::getPositionColorShader);


if (Minecraft.getInstance().options.graphicsMode().get() != GraphicsStatus.FABULOUS) {
RenderSystem.depthMask(false);
RenderSystem.enableCull();
}

final int h = player.level().getHeight();
final int h0 = (int) player.getY();
final int h1 = Math.min(h, h0 - 16);
Expand Down Expand Up @@ -95,12 +89,8 @@ public static void renderOverlays(PoseStack matrixstack) {

// restore render settings
RenderSystem.depthMask(true);
if (Minecraft.getInstance().options.graphicsMode().get() != GraphicsStatus.FABULOUS) {
RenderSystem.disableCull();
} else {
RenderSystem.lineWidth(1.0F);
RenderSystem.enableBlend();
}
RenderSystem.lineWidth(1.0F);
RenderSystem.enableBlend();
}

public static void renderEdge(PoseStack matrixstack, double x, double z, double h3, double h, int color) {
Expand Down
35 changes: 16 additions & 19 deletions src/client/java/at/ridgo8/moreoverlays/itemsearch/ItemUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,17 @@

import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentInstance;
import net.minecraft.world.item.enchantment.ItemEnchantments;
import net.minecraft.world.item.EnchantedBookItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.core.Holder;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.Tag;

import net.minecraft.nbt.ListTag;

import at.ridgo8.moreoverlays.MoreOverlays;

import java.util.Collection;
import java.util.Collections;
import java.util.HashSet;
Expand All @@ -23,40 +28,32 @@ public static boolean ingredientMatches(Object ingredient, ItemStack stack) {
ItemStack stack1 = (ItemStack) ingredient;
return ItemStack.isSameItem(stack, stack1) && JeiModule.areItemsEqualInterpreter(stack1, stack);
} else if (ingredient instanceof EnchantmentInstance) {
ListTag tags;
if (stack.getItem() instanceof EnchantedBookItem) {
tags = EnchantedBookItem.getEnchantments(stack);
} else {
tags = stack.getEnchantmentTags();
}
ItemEnchantments tags;
tags = stack.getEnchantments();
return getEnchantmentData(tags).stream().anyMatch((ench) -> ench.enchantment.equals(((EnchantmentInstance) ingredient).enchantment) &&
ench.level == ((EnchantmentInstance) ingredient).level);
}

return false;
}

public static Collection<EnchantmentInstance> getEnchantmentData(ListTag nbtList) {
public static Collection<EnchantmentInstance> getEnchantmentData(ItemEnchantments nbtList) {
if (nbtList == null) {
return Collections.emptySet();
}

Collection<EnchantmentInstance> enchantments = new HashSet<>();
for (Tag nbt : nbtList) {
if (nbt instanceof CompoundTag) {
CompoundTag nbttagcompound = (CompoundTag) nbt;
int id = nbttagcompound.getShort("id");
int level = nbttagcompound.getShort("lvl");
Enchantment enchantment = Enchantment.byId(id);
if (enchantment != null && level > 0) {
enchantments.add(new EnchantmentInstance(enchantment, level));
}
for (Holder<Enchantment> nbt : nbtList.keySet()) {
int level = nbt.value().getMaxLevel();

if (nbt.value() != null && level > 0) {
enchantments.add(new EnchantmentInstance(nbt.value(), level));
}
}
return enchantments;
}

public static boolean matchNBT(ItemStack a, ItemStack b) {
return a.hasTag() == b.hasTag() && (!a.hasTag() || a.getTag().equals(b.getTag()));
MoreOverlays.logger.error(a.getTags());
return a.getTags() == b.getTags(); //TODO: work on
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import com.mojang.blaze3d.vertex.*;
import org.joml.Matrix4d;
import net.minecraft.client.Camera;
import net.minecraft.client.GraphicsStatus;
import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.client.Minecraft;
Expand Down Expand Up @@ -88,11 +87,6 @@ public void renderOverlays(ILightScanner scanner, PoseStack matrixstack) {
RenderSystem.lineWidth((float) (double) Config.render_chunkLineWidth);
RenderSystem.setShader(GameRenderer::getPositionColorShader);

if (Minecraft.getInstance().options.graphicsMode().get() != GraphicsStatus.FABULOUS) {
RenderSystem.depthMask(false);
RenderSystem.enableCull();
}

float ar = ((float) ((Config.render_spawnAColor >> 16) & 0xFF)) / 255F;
float ag = ((float) ((Config.render_spawnAColor >> 8) & 0xFF)) / 255F;
float ab = ((float) (Config.render_spawnAColor & 0xFF)) / 255F;
Expand All @@ -114,11 +108,7 @@ else if (mode == 2)
tess.end();
// restore render settings
RenderSystem.depthMask(true);
if (Minecraft.getInstance().options.graphicsMode().get() != GraphicsStatus.FABULOUS) {
RenderSystem.disableCull();
} else {
RenderSystem.lineWidth(1.0F);
RenderSystem.enableBlend();
}
RenderSystem.lineWidth(1.0F);
RenderSystem.enableBlend();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@
import at.ridgo8.moreoverlays.lightoverlay.LightOverlayHandler;
import net.minecraft.client.renderer.MultiBufferSource;

import net.minecraft.client.GraphicsStatus;
import net.minecraft.client.Minecraft;

@Mixin(DebugRenderer.class)
public class MixinDebugRenderer {
@Inject(method = "render", at = @At("HEAD"))
private void render(PoseStack p_113458_, MultiBufferSource.BufferSource p_113459_, double p_113460_, double p_113461_, double p_113462_, CallbackInfo ci) {
if (ChunkBoundsHandler.getMode() != ChunkBoundsHandler.RenderMode.NONE && Minecraft.getInstance().options.graphicsMode().get() == GraphicsStatus.FABULOUS) {
if (ChunkBoundsHandler.getMode() != ChunkBoundsHandler.RenderMode.NONE ) {
ChunkBoundsRenderer.renderOverlays(p_113458_);
}
if(LightOverlayHandler.isEnabled() && Minecraft.getInstance().options.graphicsMode().get() == GraphicsStatus.FABULOUS){
if(LightOverlayHandler.isEnabled()){
LightOverlayHandler.renderer.renderOverlays(LightOverlayHandler.scanner, p_113458_);
}
}
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion src/client/resources/moreoverlays.main.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"compatibilityLevel": "JAVA_17",
"client": [
"MixinDebugRenderer",
"MixinOnRenderTail",
"MixinOverlayRenderer",
"MixinEditBox"
],
Expand Down

0 comments on commit b2ffead

Please sign in to comment.