Stop explody crusher drops

- Remove the velocity of item entities dropped by crushed mobs so they fall neatly onto belts rather than exploding everywhere.
This commit is contained in:
_0Steven 2021-02-20 18:50:40 +01:00
parent a32cbe15a3
commit 41cb2ad937

View file

@ -3,10 +3,13 @@ package com.simibubi.create.content.contraptions.components.crusher;
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.entity.item.ItemEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.DamageSource;
import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LootingLevelEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
@ -52,4 +55,14 @@ public class CrushingWheelTileEntity extends KineticTileEntity {
event.setLootingLevel(2); //This does not currently increase mob drops. It seems like this only works for damage done by an entity.
}
@SubscribeEvent
public static void handleCrushedMobDrops(LivingDropsEvent event) {
if (event.getSource() != CrushingWheelTileEntity.damageSource)
return;
Vec3d outSpeed = Vec3d.ZERO;
for (ItemEntity outputItem : event.getDrops()) {
outputItem.setMotion(outSpeed);
}
}
}