Fixed mushroom stews cosuming with the config turned on and added some water sounds for boats
parent
dd1e18a91c
commit
986e65dc9f
|
@ -115,7 +115,7 @@ public class WyHelper {
|
|||
// player.dropItem(new ItemInstance(Tile.SLAB, 64));
|
||||
// player.dropItem(new ItemInstance(ItemType.minecart, 1));
|
||||
// player.dropItem(new ItemInstance(ItemType.minecartFurnace, 1));
|
||||
player.dropItem(new ItemInstance(ItemType.sign));
|
||||
player.dropItem(new ItemInstance(ItemType.boat));
|
||||
// player.dropItem(new ItemInstance(Tile.STONE_SLAB, 1, 2));
|
||||
// player.dropItem(new ItemInstance(Tile.GOLDEN_RAIL, 64));
|
||||
// player.dropItem(new ItemInstance(Tile.COBBLESTONE, 64));
|
||||
|
|
|
@ -7,7 +7,9 @@ import org.spongepowered.asm.mixin.injection.Inject;
|
|||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import net.minecraft.entity.Boat;
|
||||
import net.minecraft.util.maths.MathsHelper;
|
||||
import xyz.pixelatedw.finalbeta.ModConfig;
|
||||
import xyz.pixelatedw.finalbeta.WyHelper;
|
||||
|
||||
@Mixin(Boat.class)
|
||||
public class BoatMixin {
|
||||
|
@ -21,7 +23,7 @@ public class BoatMixin {
|
|||
* check, which we're setting to false before the vanilla check happens
|
||||
* if the boat is set to survive the impact from our checks.
|
||||
*
|
||||
* Do note that they way the boat collision check happens is that the
|
||||
* Do note that the way the boat collision check happens is that the
|
||||
* boat gets slowed down first, and then the velocity check is
|
||||
* performed, by default a velocity check is 0.15, we're raising that
|
||||
* limit to 0.22.
|
||||
|
@ -29,6 +31,12 @@ public class BoatMixin {
|
|||
if (this.isCollidingHorizontally(boat) && this.canSurvive(boat)) {
|
||||
((Boat) (Object) this).field_1624 = false;
|
||||
}
|
||||
|
||||
if (boat.passenger != null && boat.field_1645 % 39 == 1) {
|
||||
float speed = MathsHelper.sqrt(boat.velocityX * boat.velocityX + boat.velocityZ * boat.velocityZ);
|
||||
float volume = WyHelper.lerp(WyHelper.clamp(speed, 0.0F, 0.25F), 0.0F, 0.7F);
|
||||
boat.level.playSound(boat.x, boat.y, boat.z, "sound3.liquid.water", volume, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean canSurvive(Boat boat) {
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
package xyz.pixelatedw.finalbeta.mixin;
|
||||
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
import net.minecraft.entity.player.Player;
|
||||
import net.minecraft.item.ItemInstance;
|
||||
import net.minecraft.item.food.MushroomStewItem;
|
||||
import net.minecraft.level.Level;
|
||||
import xyz.pixelatedw.finalbeta.ModConfig;
|
||||
|
||||
@Mixin(MushroomStewItem.class)
|
||||
public class MushroomStewItemMixin {
|
||||
@Inject(method = "use", at = @At("HEAD"), cancellable = true)
|
||||
public void use(ItemInstance stack, Level level, Player player, CallbackInfoReturnable<ItemInstance> cir) {
|
||||
if (ModConfig.DISABLE_EATING_WHEN_MAX_HP.get() && player.health >= 20) {
|
||||
cir.setReturnValue(stack);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -51,7 +51,8 @@
|
|||
"LeavesTileMixin",
|
||||
"StillFluidTileMixin",
|
||||
"FlowingFluidTileMixin",
|
||||
"ClientInteractionManagerMixin"
|
||||
"ClientInteractionManagerMixin",
|
||||
"MushroomStewItemMixin"
|
||||
],
|
||||
"injectors": {
|
||||
"defaultRequire": -1
|
||||
|
|
Loading…
Reference in New Issue