Skip to content

Commit

Permalink
first bit of 1.21.3 port
Browse files Browse the repository at this point in the history
  • Loading branch information
Uraneptus committed Oct 23, 2024
1 parent 16e4921 commit 4a5a30a
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 22 deletions.
6 changes: 3 additions & 3 deletions Fabric/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.7.2'
id 'fabric-loom' version '1.8.9'
}

version = "${mc_version}-${build_number}-FABRIC"
Expand Down Expand Up @@ -31,8 +31,8 @@ dependencies {
minecraft "com.mojang:minecraft:${mc_version}"
mappings loom.officialMojangMappings()

modImplementation "net.fabricmc:fabric-loader:0.16.0"
modImplementation "net.fabricmc.fabric-api:fabric-api:0.100.8+1.21"
modImplementation "net.fabricmc:fabric-loader:${fabric_loader_version}"
modImplementation "net.fabricmc.fabric-api:fabric-api:${fabric_api_version}"

compileOnly project(":Xplat")

Expand Down
4 changes: 2 additions & 2 deletions Fabric/src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"accessWidener": "neat.accesswidener",

"depends": {
"fabricloader": ">=0.15.11",
"fabricloader": ">=0.16.7",
"fabric": ">=0.100",
"minecraft": ">=1.21"
"minecraft": ">=1.21.2"
}
}
4 changes: 2 additions & 2 deletions NeoForge/src/main/resources/META-INF/neoforge.mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ description="Minimalistic Functional Unit Plates for the modern Minecrafter"
[[dependencies.neat]]
modId="neoforge"
type="required"
versionRange="[21.0.143,)"
versionRange="[21.2.0-beta,)"

[[dependencies.neat]]
modId="minecraft"
type="required"
versionRange="[1.21,)"
versionRange="[1.21.2,)"

[[mixins]]
config="neat.mixins.json"
10 changes: 6 additions & 4 deletions Xplat/src/main/java/vazkii/neat/HealthBarRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.state.EntityRenderState;
import net.minecraft.client.renderer.texture.OverlayTexture;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
Expand Down Expand Up @@ -54,7 +55,7 @@ private static Entity getEntityLookedAt(Entity e) {
for (Entity entity : entitiesInBoundingBox) {
Entity lookedEntity = null;
if (entity.isPickable()) {
AABB collisionBox = entity.getBoundingBoxForCulling();
AABB collisionBox = entity.getBoundingBox();
Optional<Vec3> interceptPosition = collisionBox.clip(positionVector, reachVector);

if (collisionBox.contains(positionVector)) {
Expand Down Expand Up @@ -206,8 +207,8 @@ private static boolean shouldShowPlate(LivingEntity living, Entity cameraEntity)
return visible;
}

public static void hookRender(Entity entity, PoseStack poseStack, MultiBufferSource buffers,
Camera camera, EntityRenderer<? super Entity> entityRenderer,
public static <E extends Entity, S extends EntityRenderState> void hookRender(Entity entity, PoseStack poseStack, MultiBufferSource buffers,
Camera camera, EntityRenderer<? super E, S> entityRenderer,
float partialTicks, double x, double y, double z) {
final Minecraft mc = Minecraft.getInstance();
if (!(entity instanceof LivingEntity living)) {
Expand All @@ -230,7 +231,8 @@ public static void hookRender(Entity entity, PoseStack poseStack, MultiBufferSou
final float nameLen = mc.font.width(name) * textScale;
final float halfSize = Math.max(NeatConfig.instance.plateSize(), nameLen / 2.0F + 10.0F);

Vec3 vec3 = entityRenderer.getRenderOffset(entity, partialTicks);
S renderState = entityRenderer.createRenderState();
Vec3 vec3 = entityRenderer.getRenderOffset(renderState);
double d2 = x + vec3.x();
double d3 = y + vec3.y();
double d0 = z + vec3.z();
Expand Down
3 changes: 2 additions & 1 deletion Xplat/src/main/java/vazkii/neat/NeatRenderType.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.client.renderer.RenderType;
import net.minecraft.resources.ResourceLocation;

import net.minecraft.util.TriState;
import vazkii.neat.mixin.AccessorRenderType;

import static com.mojang.blaze3d.vertex.DefaultVertexFormat.*;
Expand All @@ -23,7 +24,7 @@ private NeatRenderType(String string, Runnable r, Runnable r1) {
private static RenderType getHealthBarType() {
RenderType.CompositeState renderTypeState = RenderType.CompositeState.builder()
.setShaderState(POSITION_COLOR_TEX_LIGHTMAP_SHADER)
.setTextureState(new TextureStateShard(NeatRenderType.HEALTH_BAR_TEXTURE, false, false))
.setTextureState(new TextureStateShard(NeatRenderType.HEALTH_BAR_TEXTURE, TriState.FALSE, false))
.setTransparencyState(TRANSLUCENT_TRANSPARENCY)
.setCullState(NO_CULL)
.setLightmapState(LIGHTMAP)
Expand Down
12 changes: 9 additions & 3 deletions Xplat/src/main/java/vazkii/neat/mixin/EntityRendererMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
import com.mojang.blaze3d.vertex.PoseStack;

import net.minecraft.client.renderer.MultiBufferSource;
import net.minecraft.client.renderer.entity.EntityRenderDispatcher;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.state.EntityRenderState;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -21,9 +25,11 @@
@Mixin(EntityRenderer.class)
public class EntityRendererMixin {

@Inject(method = "render(Lnet/minecraft/world/entity/Entity;FFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderer;renderNameTag(Lnet/minecraft/world/entity/Entity;Lnet/minecraft/network/chat/Component;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;IF)V"), cancellable = true)
private void neat_disableNameTag(Entity entity, float $$1, float $$2, PoseStack $$3, MultiBufferSource $$4, int $$5, CallbackInfo ci) {
if (NeatConfig.instance.disableNameTag() && (!NeatConfig.instance.disableNameTagIfHealthbar() || neat$allowNameTagDisable(entity))) {
@Shadow @Final protected EntityRenderDispatcher entityRenderDispatcher;

@Inject(method = "render(Lnet/minecraft/client/renderer/entity/state/EntityRenderState;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderer;renderNameTag(Lnet/minecraft/client/renderer/entity/state/EntityRenderState;Lnet/minecraft/network/chat/Component;Lcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V"), cancellable = true)
private void neat_disableNameTag(EntityRenderState renderState, PoseStack $$1, MultiBufferSource $$2, int $$3, CallbackInfo ci) {
if (NeatConfig.instance.disableNameTag() /*&& (!NeatConfig.instance.disableNameTagIfHealthbar() TODO || neat$allowNameTagDisable(renderState)))*/) {
ci.cancel();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public class LevelRendererMixin {
@Inject(
method = "renderEntity(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;)V",
at = @At(
value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;render(Lnet/minecraft/world/entity/Entity;DDDFFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/EntityRenderDispatcher;render(Lnet/minecraft/world/entity/Entity;DDDFLcom/mojang/blaze3d/vertex/PoseStack;Lnet/minecraft/client/renderer/MultiBufferSource;I)V",
shift = At.Shift.AFTER
)
)
Expand Down
8 changes: 5 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ org.gradle.jvmargs=-Xmx2G \
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED

group=vazkii.neat
neoforge_version=21.1.63
neoforge_version=21.3.0-beta
fabric_loader_version=0.16.7
fabric_api_version=0.106.1+1.21.3
mod_id=neat
build_number=41
build_number=42
mod_name=Neat
mc_version=1.21
mc_version=1.21.3
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.8-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
4 changes: 2 additions & 2 deletions scripts/upload_releases.sh
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function release_github() {
gh release upload "${TAGNAME}" "${FABRIC_JAR}.asc#Fabric Signature"
echo >&2 'Uploading NeoForge Jar and Signature to GitHub'
gh release upload "${TAGNAME}" "${NEOFORGE_JAR}#NeoForge Jar"
gh release upload "${TAGNAME}" "${NEOFORGE_JAR}.asc#Forge Signature"
gh release upload "${TAGNAME}" "${NEOFORGE_JAR}.asc#NeoForge Signature"
}

function release_modrinth() {
Expand Down Expand Up @@ -142,7 +142,7 @@ $CURSEFORGE_GAME_VERSION]"
-F "file=@$FABRIC_JAR"
# TODO: Upload the asc as an 'Additional file'

echo >&2 'Uploading Forge Jar to CurseForge'
echo >&2 'Uploading NeoForge Jar to CurseForge'
local CURSEFORGE_NEOFORGE_SPEC
CURSEFORGE_NEOFORGE_SPEC=$(cat <<EOF
{
Expand Down

0 comments on commit 4a5a30a

Please sign in to comment.