Skip to content
This repository has been archived by the owner on Jan 4, 2024. It is now read-only.

Commit

Permalink
Fix usage of client-side only class in mixin
Browse files Browse the repository at this point in the history
Fixes #18
  • Loading branch information
florensie committed Jan 23, 2021
1 parent 486fece commit 1990b87
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [2.2.1] - 2020-01-23
### Fixed
- Dedicated server fails to start due to mixin not finding client-side only class

## [2.2.0] - 2021-01-23
### Added
- Config option to disable extra hurt sounds for Kitty Slippers and Bunny Hoppers
Expand Down Expand Up @@ -96,3 +100,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [1.0.0] - 2020-11-02
### Added
- Initial release

[Unreleased]: https://github.com/florensie/artifacts-fabric/compare/v2.2.1...HEAD
[2.2.1]: https://github.com/florensie/artifacts-fabric/compare/v2.2.0...v2.2.1
[2.2.0]: https://github.com/florensie/artifacts-fabric/releases/tag/v2.2.0
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ yarn_mappings=1.16.5+build.3
loader_version=0.11.1

# Mod Properties
mod_version=2.2.0+fabric
mod_version=2.2.1+fabric
maven_group=artifacts
archives_base_name=artifacts

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import artifacts.common.item.trinket.CloudInABottleItem;
import artifacts.common.trinkets.TrinketsHelper;
import artifacts.mixin.extensions.LivingEntityExtensions;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking;
import net.fabricmc.fabric.api.networking.v1.PacketByteBufs;
import net.minecraft.entity.Entity;
Expand Down Expand Up @@ -64,12 +66,19 @@ public LivingEntityMixin(EntityType<?> type, World world) {

// Send double jump packet to server if we're on the client
if (this.world.isClient) {
ClientPlayNetworking.send(CloudInABottleItem.C2S_DOUBLE_JUMPED_ID, PacketByteBufs.empty());
sendDoubleJumpPacket();
}

this.isDoubleJumping = false;
}

// This code is extracted because the mixin fails to apply with the usage of client-side only classes
@Unique
@Environment(EnvType.CLIENT)
private static void sendDoubleJumpPacket() {
ClientPlayNetworking.send(CloudInABottleItem.C2S_DOUBLE_JUMPED_ID, PacketByteBufs.empty());
}

@ModifyVariable(method = "handleFallDamage", ordinal = 0, at = @At("HEAD"))
private float reduceFallDistance(float fallDistance) {
// FIXME: this probably also works if we didn't double jump, intended?
Expand Down

0 comments on commit 1990b87

Please sign in to comment.