Fixed saddled pigs not dropping their saddles on death and slightly adjusted the minecart's hitbox again

master
Wynd 2023-04-13 21:14:16 +03:00
parent 687251779a
commit 6a3de4f59d
6 changed files with 45 additions and 11 deletions

View File

@ -168,6 +168,16 @@ After:
</details>
<details><summary>Fixes saddled pigs not dropping their saddles on death</summary>
Before:
![pig not dropping its saddle on death](https://i.imgur.com/PVLRNn5.mp4)
After:
![pig dropping its saddle on death](https://i.imgur.com/0yHHfxB.mp4)
</details>
## Troubleshooting
**Q: My achievements screen is all messed up**

View File

@ -31,7 +31,9 @@ public class ModConfig {
"Fixes pickaxes not being effective agaist certain blocks that it should be effective on");
public static final Option<Boolean> FIX_AXE_EFFECTIVENESS = make("Fix axe effectiveness", true,
"Fixes axes not being effective agaist certain blocks that it should be effective on");
public static final Option<Boolean> FIX_SADDLES_NOT_DROPPING = make("Fix saddles not dropping", true,
"Fixes saddles not dropping when killing saddled pigs");
private static ModConfig instance = new ModConfig();
public static final ModConfig instance() {
return instance;

View File

@ -23,11 +23,10 @@ public class WyHelper {
public static void cheatCommand(Player player) {
Random rand = new Random();
// player.level.playSound(player, "random.break", 1, (rand.nextFloat() - rand.nextFloat()) * 0.2F + 1.0F);
// player.damage(player, 15);
// player.dropItem(new ItemInstance(ItemType.mushroomStew, 1), false);
// player.dropItem(new ItemInstance(ItemType.saddle, 1), false);
// player.dropItem(new ItemInstance(ItemType.pickaxeGold, 1), false);
//
// player.dropItem(new ItemInstance(ItemType.bow, 1), false);
// player.dropItem(new ItemInstance(ItemType.arrow, 64), false);
// player.dropItem(new ItemInstance(Tile.STONE, 64), false);
@ -42,9 +41,6 @@ public class WyHelper {
// enemy.setPositionAndAngles(player.x + 2, player.y, player.z, 0.0f, 0.0f);
// player.level.spawnEntity(enemy);
// boolean b = ModConfig.instance().get(ModConfig.SUGAR_CANE_ON_SAND);
// System.out.println(b);
player.level.setLevelTime(0);
player.level.getProperties().setRaining(false);
player.level.getProperties().setRainTime(0);

View File

@ -0,0 +1,25 @@
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.CallbackInfo;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.animal.Pig;
import net.minecraft.item.ItemType;
import xyz.pixelatedw.finalbeta.ModConfig;
@Mixin(LivingEntity.class)
public class LivingEntityMixin {
@Inject(method = "dropLoot", at = @At("TAIL"))
public void dropLoot(CallbackInfo ci) {
if(ModConfig.FIX_SADDLES_NOT_DROPPING.get()) {
LivingEntity entity = (LivingEntity) (Object) this;
if (entity instanceof Pig && ((Pig) entity).isSaddled()) {
entity.dropItem(ItemType.saddle.id, 1);
}
}
}
}

View File

@ -19,8 +19,8 @@ import xyz.pixelatedw.finalbeta.WyHelper;
@Mixin(Minecart.class)
public class MinecartMixin {
private static final double EXTRA_MINECART_XZ_SIZE = 0.3;
private static final double EXTRA_MINECART_Y_SIZE = 0.1;
private static final double EXTRA_MINECART_XZ_SIZE = 0.4;
private static final double EXTRA_MINECART_Y_SIZE = 0.0;
@Inject(method = "method_1379", at = @At("HEAD"), cancellable = true)
public void onCollision(Entity other, CallbackInfoReturnable<Box> ci) {

View File

@ -22,7 +22,8 @@
"MinecartMixin",
"LivingEntityRendererMixin",
"FishHookMixin",
"TileRendererMixin"
"TileRendererMixin",
"LivingEntityMixin"
],
"injectors": {
"defaultRequire": 1