Skip to content

Commit

Permalink
1.19.4 port
Browse files Browse the repository at this point in the history
  • Loading branch information
ZsoltMolnarrr committed Apr 7, 2023
1 parent 8d77c8b commit c9c4444
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 70 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ subprojects {
apply plugin: "io.github.juuxel.loom-quiltflower"

archivesBaseName = rootProject.archives_base_name + "-${project.name}"
version = rootProject.mod_version + "+1.19.3"
version = rootProject.mod_version + "+${rootProject.minecraft_version}"

loom {
silentMojangMappingsLicense()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.Vec3d;
import org.joml.Matrix4f;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand Down Expand Up @@ -72,32 +73,33 @@ public void renderColliderDebug(MatrixStack matrices, VertexConsumerProvider.Imm
.scale(0.95)
.updateVertex())
.collect(Collectors.toList());
drawOutline(obb, collidingObbs, collides);
drawOutline(matrices, obb, collidingObbs, collides);
}

private void drawOutline(OrientedBoundingBox obb, List<OrientedBoundingBox> otherObbs, boolean collides) {
private void drawOutline(MatrixStack matrixStack, OrientedBoundingBox obb, List<OrientedBoundingBox> otherObbs, boolean collides) {
RenderSystem.enableDepthTest();
RenderSystem.setShader(GameRenderer::getPositionColorProgram);
Tessellator tessellator = Tessellator.getInstance();
BufferBuilder bufferBuilder = tessellator.getBuffer();
RenderSystem.disableTexture();
RenderSystem.disableBlend();
RenderSystem.lineWidth(1.0f);
bufferBuilder.begin(VertexFormat.DrawMode.DEBUG_LINE_STRIP, VertexFormats.POSITION_COLOR);

if (collides) {
outlineOBB(obb, bufferBuilder,
System.out.println("Drawing collider +");
outlineOBB(matrixStack, obb, bufferBuilder,
1, 0, 0,
1, 0, 0,0.5F);
} else {
outlineOBB(obb, bufferBuilder,
System.out.println("Drawing collider -");
outlineOBB(matrixStack, obb, bufferBuilder,
0, 1, 0,
1, 1, 0,0.5F);
}
look(obb, bufferBuilder, 0.5F);
look(matrixStack, obb, bufferBuilder, 0.5F);

for(OrientedBoundingBox otherObb: otherObbs){
outlineOBB(otherObb, bufferBuilder,
outlineOBB(matrixStack, otherObb, bufferBuilder,
1, 0, 0,
1, 0, 0,0.5F);
}
Expand All @@ -106,52 +108,53 @@ private void drawOutline(OrientedBoundingBox obb, List<OrientedBoundingBox> othe

RenderSystem.lineWidth(1.0f);
RenderSystem.enableBlend();
RenderSystem.enableTexture();
}

private void outlineOBB(OrientedBoundingBox box, BufferBuilder buffer,
private void outlineOBB(MatrixStack matrixStack, OrientedBoundingBox box, BufferBuilder buffer,
float red1, float green1, float blue1,
float red2, float green2, float blue2,
float alpha) {
buffer.vertex(box.vertex1.x, box.vertex1.y, box.vertex1.z).color(0, 0, 0, 0).next();

buffer.vertex(box.vertex1.x, box.vertex1.y, box.vertex1.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex2.x, box.vertex2.y, box.vertex2.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex3.x, box.vertex3.y, box.vertex3.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex4.x, box.vertex4.y, box.vertex4.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex1.x, box.vertex1.y, box.vertex1.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex5.x, box.vertex5.y, box.vertex5.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex6.x, box.vertex6.y, box.vertex6.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex2.x, box.vertex2.y, box.vertex2.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex6.x, box.vertex6.y, box.vertex6.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex7.x, box.vertex7.y, box.vertex7.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex3.x, box.vertex3.y, box.vertex3.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex7.x, box.vertex7.y, box.vertex7.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex8.x, box.vertex8.y, box.vertex8.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex4.x, box.vertex4.y, box.vertex4.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(box.vertex8.x, box.vertex8.y, box.vertex8.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(box.vertex5.x, box.vertex5.y, box.vertex5.z).color(red2, green2, blue2, alpha).next();

buffer.vertex(box.vertex5.x, box.vertex5.y, box.vertex5.z).color(0, 0, 0, 0).next();
buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 0, 0, 0).next();
Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
buffer.vertex(matrix4f, (float) box.vertex1.x, (float) box.vertex1.y, (float) box.vertex1.z).color(0, 0, 0, 0).next();

buffer.vertex(matrix4f, (float) box.vertex1.x, (float) box.vertex1.y, (float) box.vertex1.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex2.x, (float) box.vertex2.y, (float) box.vertex2.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex3.x, (float) box.vertex3.y, (float) box.vertex3.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex4.x, (float) box.vertex4.y, (float) box.vertex4.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex1.x, (float) box.vertex1.y, (float) box.vertex1.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex5.x, (float) box.vertex5.y, (float) box.vertex5.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex6.x, (float) box.vertex6.y, (float) box.vertex6.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex2.x, (float) box.vertex2.y, (float) box.vertex2.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex6.x, (float) box.vertex6.y, (float) box.vertex6.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex7.x, (float) box.vertex7.y, (float) box.vertex7.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex3.x, (float) box.vertex3.y, (float) box.vertex3.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex7.x, (float) box.vertex7.y, (float) box.vertex7.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex8.x, (float) box.vertex8.y, (float) box.vertex8.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex4.x, (float) box.vertex4.y, (float) box.vertex4.z).color(red1, green1, blue1, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex8.x, (float) box.vertex8.y, (float) box.vertex8.z).color(red2, green2, blue2, alpha).next();
buffer.vertex(matrix4f, (float) box.vertex5.x, (float) box.vertex5.y, (float) box.vertex5.z).color(red2, green2, blue2, alpha).next();

buffer.vertex(matrix4f, (float) box.vertex5.x, (float) box.vertex5.y, (float) box.vertex5.z).color(0, 0, 0, 0).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 0, 0, 0).next();
}

private void look(OrientedBoundingBox box, BufferBuilder buffer, float alpha) {
buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 0, 0, alpha).next();
private void look(MatrixStack matrixStack, OrientedBoundingBox box, BufferBuilder buffer, float alpha) {
Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 0, 0, alpha).next();

buffer.vertex(box.center.x, box.center.y, box.center.z).color(1, 0, 0, alpha).next();
buffer.vertex(box.axisZ.x, box.axisZ.y, box.axisZ.z).color(1, 0, 0, alpha).next();
buffer.vertex(box.center.x, box.center.y, box.center.z).color(1, 0, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(1, 0, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.axisZ.x, (float) box.axisZ.y, (float) box.axisZ.z).color(1, 0, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(1, 0, 0, alpha).next();

buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 1, 0, alpha).next();
buffer.vertex(box.axisY.x, box.axisY.y, box.axisY.z).color(0, 1, 0, alpha).next();
buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 1, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 1, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.axisY.x, (float) box.axisY.y, (float) box.axisY.z).color(0, 1, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 1, 0, alpha).next();

buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 0, 1, alpha).next();
buffer.vertex(box.axisX.x, box.axisX.y, box.axisX.z).color(0, 0, 1, alpha).next();
buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 0, 1, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 0, 1, alpha).next();
buffer.vertex(matrix4f, (float) box.axisX.x, (float) box.axisX.y, (float) box.axisX.z).color(0, 0, 1, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 0, 1, alpha).next();

buffer.vertex(box.center.x, box.center.y, box.center.z).color(0, 0, 0, alpha).next();
buffer.vertex(matrix4f, (float) box.center.x, (float) box.center.y, (float) box.center.z).color(0, 0, 0, alpha).next();
}

public void printDebug(OrientedBoundingBox obb) {
Expand All @@ -178,14 +181,14 @@ private String vec3Short(Vec3d vec) {

private Vec3d[] getVertices(Box box) {
return new Vec3d[]{
new Vec3d(box.minX, box.minY, box.minZ),
new Vec3d(box.maxX, box.minY, box.minZ),
new Vec3d(box.minX, box.maxY, box.minZ),
new Vec3d(box.minX, box.minY, box.maxZ),
new Vec3d(box.maxX, box.maxY, box.minZ),
new Vec3d(box.minX, box.maxY, box.maxZ),
new Vec3d(box.maxX, box.minY, box.maxZ),
new Vec3d(box.maxX, box.maxY, box.maxZ)
new Vec3d(box.minX, (float) box.minY, (float) box.minZ),
new Vec3d(box.maxX, (float) box.minY, (float) box.minZ),
new Vec3d(box.minX, (float) box.maxY, (float) box.minZ),
new Vec3d(box.minX, (float) box.minY, (float) box.maxZ),
new Vec3d(box.maxX, (float) box.maxY, (float) box.minZ),
new Vec3d(box.minX, (float) box.maxY, (float) box.maxZ),
new Vec3d(box.maxX, (float) box.minY, (float) box.maxZ),
new Vec3d(box.maxX, (float) box.maxY, (float) box.maxZ)
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,17 @@
@Mixin(InGameHud.class)
public abstract class InGameHudInject {
@Inject(method = "renderCrosshair", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(Lnet/minecraft/client/util/math/MatrixStack;IIIIII)V"))
public void pre_renderCrosshair(MatrixStack matrices, CallbackInfo ci) {
private void pre_renderCrosshair(MatrixStack matrices, CallbackInfo ci) {
if (BetterCombatClient.config.isHighlightCrosshairEnabled) {
setShaderForHighlighting();
}
}

@Inject(method = "renderCrosshair", at = @At(value = "TAIL"))
private void post_renderCrosshair(MatrixStack matrices, CallbackInfo ci) {
RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}

private void setShaderForHighlighting() {
if(((MinecraftClient_BetterCombat)MinecraftClient.getInstance()).hasTargetsInReach()) {
var color = BetterCombatClient.config.hudHighlightColor;
Expand Down
6 changes: 3 additions & 3 deletions fabric/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ if(project.hasProperty('release_type')) {
changelog = changelog_last_section()
changelogType = 'markdown'
releaseType = release_type
addGameVersion "1.19.3"
addGameVersion "${rootProject.minecraft_version}"
addGameVersion "Fabric"

relations {
Expand All @@ -136,7 +136,7 @@ if(project.hasProperty('release_type')) {
versionNumber = "${project.version}-fabric" // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = release_type // This is the default -- can also be `beta` or `alpha`
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = ["1.19.3"] // Must be an array, even with only one version
gameVersions = ["${rootProject.minecraft_version}"] // Must be an array, even with only one version
loaders = ["fabric"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
dependencies { // A special DSL for creating dependencies
// scope.type
Expand All @@ -153,7 +153,7 @@ if(project.hasProperty('release_type')) {
owner "ZsoltMolnarrr" // default is the last part of your group. Eg group: "com.github.breadmoirai" => owner: "breadmoirai"
repo "BetterCombat" // by default this is set to your project name
tagName "${project.version}" // by default this is set to "v${project.version}"
targetCommitish "1.19.3" // by default this is set to "main"
targetCommitish "${rootProject.minecraft_version}" // by default this is set to "main"
releaseName "Release" // Release title, by default this is the same as the tagName
generateReleaseNotes false // Generate release notes automatically, if true and body is present, body will be pre-pended, if name is not given, one will be generated by the tag
// body.set "" // by default this is empty
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 @@ -33,11 +33,11 @@
"bettercombat-fabric.mixins.json"
],
"depends": {
"minecraft": ">=1.19.3",
"minecraft": ">=1.19.4",
"fabricloader": ">=0.14.0",
"fabric-api": "*",
"cloth-config": ">=9.0.0",
"player-animator": ">=0.9.9"
"player-animator": ">=1.0.2"
},
"breaks": {
"inventorio": "*"
Expand Down
4 changes: 2 additions & 2 deletions forge/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ if(project.hasProperty('release_type')) {
changelog = changelog_last_section()
changelogType = 'markdown'
releaseType = release_type
addGameVersion "1.19.3"
addGameVersion "${rootProject.minecraft_version}"
addGameVersion "Forge"

relations {
Expand All @@ -118,7 +118,7 @@ if(project.hasProperty('release_type')) {
versionNumber = "${project.version}-forge" // You don't need to set this manually. Will fail if Modrinth has this version already
versionType = release_type // This is the default -- can also be `beta` or `alpha`
uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`!
gameVersions = ["1.19.3"] // Must be an array, even with only one version
gameVersions = ["${rootProject.minecraft_version}"] // Must be an array, even with only one version
loaders = ["forge"] // Must also be an array - no need to specify this if you're using Loom or ForgeGradle
dependencies { // A special DSL for creating dependencies
// scope.type
Expand Down
6 changes: 3 additions & 3 deletions forge/src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ modId="forge" #mandatory
# Does this dependency have to exist - if not, ordering below must be specified
mandatory=true #mandatory
# The version range of the dependency
versionRange="[44,)" #mandatory
versionRange="[45,)" #mandatory
# An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory
ordering="NONE"
# Side this dependency is applied on - BOTH, CLIENT or SERVER
Expand All @@ -61,12 +61,12 @@ side="BOTH"
[[dependencies.bettercombat]]
modId="playeranimator"
mandatory=true
versionRange="[0.9.9,)"
versionRange="[1.0.2,)"
ordering="AFTER"
side="BOTH"
[[dependencies.bettercombat]]
modId="cloth_config"
mandatory=true
versionRange="[9.0.0,)"
versionRange="[10.0.0,)"
ordering="AFTER"
side="BOTH"
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,24 @@ org.gradle.daemon=false
platforms=fabric,forge

# Game
minecraft_version=1.19.3
yarn_mappings=1.19.3+build.2
minecraft_version=1.19.4
yarn_mappings=1.19.4+build.1

# Loader
fabric_version=0.68.1+1.19.3
fabric_version=0.77.0+1.19.4
loader_version=0.14.11
forge_version=44.0.0
forge_version=45.0.43

# Mod Properties
mod_version=1.6.2
maven_group=net
archives_base_name=bettercombat

# Dependencies
cloth_config_version=9.0.94
player_anim_version=1.0.0-rc1+1.19.3
cloth_config_version=10.0.96
player_anim_version=1.0.2+1.19.4
tiny_config_version=2.3.2

# Compatibility
mod_menu_version=5.0.1
fpm_version=2.2.0-1.19.3-fabric
mod_menu_version=6.1.0-rc.4
fpm_version=2.2.3-1.19.4

0 comments on commit c9c4444

Please sign in to comment.