Skip to content

Commit

Permalink
Update to 1.20.6 Closes #48
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeF53 committed May 8, 2024
1 parent 00d0464 commit 6f49b5d
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 17
java-version: 21
- name: make gradle wrapper executable
run: chmod +x ./gradlew
- name: build
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id 'fabric-loom' version '1.4-SNAPSHOT'
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
}

Expand Down
16 changes: 8 additions & 8 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ org.gradle.jvmargs=-Xmx1G

# Fabric Properties
# check these on https://fabricmc.net/develop/
minecraft_version=1.20.2
yarn_mappings=1.20.2+build.4
loader_version=0.15.0
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.11

# Mod Properties
mod_version = 2.1.3
mod_version = 2.1.4
maven_group = com.HorseBuff
archives_base_name = HorseBuff

# Dependencies
fabric_version=0.91.1+1.20.2
cloth_config_version=12.0.111
mod_menu_version=8.0.0
mixinextras_version=0.2.0
fabric_version=0.98.0+1.20.6
cloth_config_version=14.0.126
mod_menu_version=10.0.0-beta.1
mixinextras_version=0.3.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.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.entity.passive.HorseEntity;
import net.minecraft.util.Identifier;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

Expand All @@ -18,12 +19,13 @@
@Mixin(value = HorseArmorFeatureRenderer.class, priority = 960)
public class TransparentArmor {

@Unique
private float opacity;

@Inject(method = "render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;ILnet/minecraft/entity/passive/HorseEntity;FFFFFF)V",
at = @At("HEAD"))
void fetchOpacity(MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int light, HorseEntity horseEntity, float limbAngle, float limbDistance, float tickDelta, float animationProgress, float headYaw, float headPitch, CallbackInfo ci) {
if (horseEntity.hasArmorInSlot() && ModConfig.getInstance().pitchFade.enabled && horseEntity.hasPassenger(MinecraftClient.getInstance().player)) {
if (horseEntity.isWearingBodyArmor() && ModConfig.getInstance().pitchFade.enabled && horseEntity.hasPassenger(MinecraftClient.getInstance().player)) {
ClientPlayerEntity player = MinecraftClient.getInstance().player;
assert player != null;
opacity = getOpacity(player);
Expand Down
26 changes: 0 additions & 26 deletions src/main/java/net/F53/HorseBuff/mixin/Server/BreakSpeed.java

This file was deleted.

69 changes: 69 additions & 0 deletions src/main/java/net/F53/HorseBuff/mixin/Server/MountedModifiers.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
package net.F53.HorseBuff.mixin.Server;

import net.F53.HorseBuff.config.ModConfig;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.attribute.EntityAttributeInstance;
import net.minecraft.entity.attribute.EntityAttributeModifier;
import net.minecraft.entity.attribute.EntityAttributes;
import net.minecraft.entity.passive.AbstractHorseEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.world.ServerWorld;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;

// adds DataPack attribute modifiers to player & horse while mounted to
// - increase horse's StepHeight by 10% (when enabled)
// - remove BreakSpeed debuff from not being grounded (when enabled)
@Mixin(value = PlayerEntity.class, priority = 960)
public abstract class MountedModifiers extends LivingEntity {
protected MountedModifiers(EntityType<? extends LivingEntity> entityType, World world) {
super(entityType, world);
}

@Unique
EntityAttributeModifier mountedStepHeight = new EntityAttributeModifier("HorseBuff-MountedStepHeight", 0.1, EntityAttributeModifier.Operation.ADD_VALUE);
@Unique
EntityAttributeModifier mountedBreakSpeed = new EntityAttributeModifier("HorseBuff-MountedBreakSpeed", 5, EntityAttributeModifier.Operation.ADD_MULTIPLIED_BASE);

@Unique
public boolean startRiding(Entity entity, boolean force) {
boolean result = super.startRiding(entity, force);
if (!(super.getWorld() instanceof ServerWorld && entity instanceof AbstractHorseEntity horse))
return result;

if (ModConfig.getInstance().stepHeight) {
EntityAttributeInstance stepHeight = horse.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT);
if (stepHeight != null) stepHeight.addTemporaryModifier(mountedStepHeight);
}

if (ModConfig.getInstance().breakSpeed) {
EntityAttributeInstance breakSpeed = getAttributeInstance(EntityAttributes.PLAYER_BLOCK_BREAK_SPEED);
if (breakSpeed != null) breakSpeed.addTemporaryModifier(mountedBreakSpeed);
}
return result;
}

@Unique
public boolean startRiding(Entity entity) {
return this.startRiding(entity, false);
}

@Unique
public void stopRiding() {
if (!(super.getWorld() instanceof ServerWorld && getVehicle() instanceof AbstractHorseEntity horse)) {
super.stopRiding();
return;
}

EntityAttributeInstance stepHeight = horse.getAttributeInstance(EntityAttributes.GENERIC_STEP_HEIGHT);
if (stepHeight != null) stepHeight.removeModifier(mountedStepHeight);

EntityAttributeInstance breakSpeed = getAttributeInstance(EntityAttributes.PLAYER_BLOCK_BREAK_SPEED);
if (breakSpeed != null) breakSpeed.removeModifier(mountedBreakSpeed);

super.stopRiding();
}
}
19 changes: 0 additions & 19 deletions src/main/java/net/F53/HorseBuff/mixin/Server/StepHeight.java

This file was deleted.

4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
],

"depends": {
"fabricloader": ">=0.14.23",
"minecraft": ">=1.20.2",
"fabricloader": ">=0.15.11",
"minecraft": ">=1.20.6",
"java": ">=17"
}
}
3 changes: 1 addition & 2 deletions src/main/resources/horsebuff.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
"PortalHorse.AllowPortalUse",
"PortalHorse.OnCollideEnd",
"PortalHorse.TickNether",
"Server.BreakSpeed",
"Server.ClearFutureTickEvents",
"Server.MovementCheck",
"Server.NoBuck",
"Server.NoWander",
"Server.StepHeight"
"Server.MountedModifiers"
],
"client": [
"Client.HeadPitchOffset",
Expand Down

0 comments on commit 6f49b5d

Please sign in to comment.