Fix minecart coupling item dupe

This commit is contained in:
reidbhuntley 2021-05-28 14:42:47 -04:00
parent 5975a3cbac
commit 0aaa09260b

View file

@ -4,6 +4,8 @@ import com.simibubi.create.AllItems;
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController;
import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController;
import com.simibubi.create.foundation.utility.Iterate;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.minecart.AbstractMinecartEntity;
import net.minecraft.entity.player.PlayerEntity;
@ -78,6 +80,11 @@ public class MinecartCouplingItem extends Item {
if (event.getWorld().isRemote)
return true;
for (boolean forward : Iterate.trueAndFalse) {
if (controller.hasContraptionCoupling(forward))
couplings--;
}
CouplingHandler.status(player, "removed");
controller.decouple();
if (!player.isCreative())