Skip to content

Commit

Permalink
ite moving change
Browse files Browse the repository at this point in the history
  • Loading branch information
baguchi committed Jun 5, 2024
1 parent 9f3b100 commit 471c4c5
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 32 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
package baguchan.better_with_aquatic.mixin;

import net.minecraft.core.block.material.Material;
import net.minecraft.core.entity.Entity;
import net.minecraft.core.entity.EntityItem;
import net.minecraft.core.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;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import org.spongepowered.asm.mixin.injection.Redirect;

@Mixin(value = EntityItem.class, remap = false)
public abstract class EntityItemMixin extends Entity {
Expand All @@ -17,22 +14,12 @@ public EntityItemMixin(World world) {
super(world);
}

@Inject(method = "checkAndHandleWater", at = @At("HEAD"), cancellable = true)
public void checkAndHandleWater(CallbackInfoReturnable<Boolean> cir) {
if (this.world.isMaterialInBB(this.bb, Material.water)) {
cir.setReturnValue(true);
}
}

@Inject(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/core/entity/EntityItem;yd:D", ordinal = 0))
public void tick(CallbackInfo ci) {
@Redirect(method = "tick", at = @At(value = "FIELD", target = "Lnet/minecraft/core/entity/EntityItem;yd:D", ordinal = 7))
public double tick(EntityItem instance) {
if (this.wasInWater) {
this.yd += 0.045F;
if (this.yd > 0.0) {
this.xd *= 0.95f;
this.yd *= 0.95f;
this.zd *= 0.95f;
}
this.yd *= 0.95f;
}
return this.yd;
}
}
11 changes: 0 additions & 11 deletions src/main/java/baguchan/better_with_aquatic/mixin/EntityMixin.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
package baguchan.better_with_aquatic.mixin;

import net.minecraft.core.block.material.Material;
import net.minecraft.core.entity.Entity;
import net.minecraft.core.util.phys.AABB;
import net.minecraft.core.world.World;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

@Mixin(value = Entity.class, remap = false)
public class EntityMixin {
Expand All @@ -18,11 +14,4 @@ public class EntityMixin {
@Shadow
@Final
public AABB bb;

@Inject(method = "checkAndHandleWater", at = @At("HEAD"), cancellable = true)
public void checkAndHandleWater(CallbackInfoReturnable<Boolean> cir) {
if (this.world.isMaterialInBB(this.bb, Material.water)) {
cir.setReturnValue(true);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(value = EntityClientPlayerMP.class, remap = false)
public abstract class EntityPlayerMPMixin extends EntityPlayerSP implements ISwiming {
public abstract class EntityClientPlayerMPMixin extends EntityPlayerSP implements ISwiming {
@Unique
public boolean swimmingOld;

public EntityPlayerMPMixin(Minecraft minecraft, World world, Session session, NetClientHandler netclienthandler) {
public EntityClientPlayerMPMixin(Minecraft minecraft, World world, Session session, NetClientHandler netclienthandler) {
super(minecraft, world, session, 0);
}

Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/better_with_aquatic.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
],
"client": [
"client.ChunkRendererMixin",
"client.EntityPlayerMPMixin",
"client.EntityClientPlayerMPMixin",
"client.EntityPlayerSPMixin",
"client.ModelPlayerMixin",
"client.PlayerInputMixin",
Expand Down

0 comments on commit 471c4c5

Please sign in to comment.