Skip to content

Commit

Permalink
Fix incompatibility with carpet
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Feb 28, 2024
1 parent 2da081d commit 82f3fdc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ if (System.getenv("MODRINTH")) {
token = System.getenv("MODRINTH")
projectId = 'wHXli9kE'// The ID of your modrinth project, slugs will not work.
versionNumber = "" + version // The version of the mod to upload.
versionType = "release"
versionType = "alpha"
uploadFile = remapJar // This links to a task that builds your mod jar and sets "uploadFile" to the mod jar.
gameVersions = [((String) project.minecraft_version)]
changelog = System.getenv("CHANGELOG")
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ yarn_mappings=1.20.4+build.3
loader_version=0.15.6

# Mod Properties
mod_version=0.0.15.0
mod_version=0.0.15.1
maven_group=eu.pb4.ansharpatch
archives_base_name=anshar-polymer-patch

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,35 @@
import com.lgmrszd.anshar.transport.PlayerTransportComponent;
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import com.mojang.authlib.GameProfile;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ServerPlayerEntity.class)
public class ServerPlayerEntityMixin {
@ModifyExpressionValue(method = "updateInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;hasVehicle()Z"))
private boolean orIsInNetwork(boolean value) {
return value || PlayerTransportComponent.KEY.get(this).isInNetwork();
public abstract class ServerPlayerEntityMixin extends PlayerEntity {
public ServerPlayerEntityMixin(World world, BlockPos pos, float yaw, GameProfile gameProfile) {
super(world, pos, yaw, gameProfile);
}

@Inject(method = "updateInput", at = @At("TAIL"))
private void orIsInNetwork(float sidewaysSpeed, float forwardSpeed, boolean jumping, boolean sneaking, CallbackInfo ci) {
if (PlayerTransportComponent.KEY.get(this).isInNetwork()) {
if (sidewaysSpeed >= -1.0F && sidewaysSpeed <= 1.0F) {
this.sidewaysSpeed = sidewaysSpeed;
}

if (forwardSpeed >= -1.0F && forwardSpeed <= 1.0F) {
this.forwardSpeed = forwardSpeed;
}

this.jumping = jumping;
this.setSneaking(sneaking);
};
}
}

0 comments on commit 82f3fdc

Please sign in to comment.