generated from Turnip-Labs/bta-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/baguchan/better_with_aquatic/mixin/EntityItemMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
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; | ||
|
||
@Mixin(value = EntityItem.class, remap = false) | ||
public abstract class EntityItemMixin extends Entity { | ||
|
||
public EntityItemMixin(World world) { | ||
super(world); | ||
} | ||
|
||
@Inject(method = "checkAndHandleWater", at = @At("HEAD"), cancellable = true) | ||
public void checkAndHandleWater(CallbackInfoReturnable<Boolean> cir) { | ||
cir.setReturnValue(this.world.isMaterialInBB(this.bb, Material.water)); | ||
} | ||
|
||
@Inject(method = "tick", at = @At("TAIL")) | ||
public void tick(CallbackInfo ci) { | ||
if (this.wasInWater) { | ||
this.yd += 0.1F; | ||
this.yd *= (double) 0.85f; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters