From 41cb2ad9374f55d22dbccc491147ec21b268ed8b Mon Sep 17 00:00:00 2001 From: _0Steven <42909981+SuicidalSteve@users.noreply.github.com> Date: Sat, 20 Feb 2021 18:50:40 +0100 Subject: [PATCH] Stop explody crusher drops - Remove the velocity of item entities dropped by crushed mobs so they fall neatly onto belts rather than exploding everywhere. --- .../components/crusher/CrushingWheelTileEntity.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java index 63aced587..fb6117988 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java @@ -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); + } + } + }