Search in sources :

Example 1 with DropperMinecartEntity

use of eu.pb4.tatercart.entity.minecart.storage.DropperMinecartEntity in project TaterCart by Patbox.

the class AbstractMinecartEntityMixin method tatercart_onCreate.

@Inject(method = "create", at = @At("HEAD"), cancellable = true)
private static void tatercart_onCreate(World world, double x, double y, double z, AbstractMinecartEntity.Type type, CallbackInfoReturnable<AbstractMinecartEntity> cir) {
    var dyeColor = CustomMinecartType.COLORED.inverse().getOrDefault(type, null);
    AbstractMinecartEntity entity;
    if (dyeColor != null) {
        entity = new ColoredMinecartEntity(TcEntities.COLORED_MINECART.get(dyeColor), world);
    } else if (type == CustomMinecartType.SLIME) {
        entity = new SlimeMinecartEntity(TcEntities.SLIME_MINECART, world);
    } else if (type == CustomMinecartType.BARREL) {
        entity = new BarrelMinecartEntity(TcEntities.BARREL_MINECART, world);
    } else if (type == CustomMinecartType.SHULKER) {
        entity = new ShulkerMinecartEntity(TcEntities.SHULKER_MINECART, world);
    } else if (type == CustomMinecartType.DISPENSER) {
        entity = new DispenserMinecartEntity(TcEntities.DISPENSER_MINECART, world);
    } else if (type == CustomMinecartType.DROPPER) {
        entity = new DropperMinecartEntity(TcEntities.DROPPER_MINECART, world);
    } else {
        entity = null;
    }
    if (entity != null) {
        entity.setPosition(x, y, z);
        cir.setReturnValue(entity);
    }
}
Also used : ShulkerMinecartEntity(eu.pb4.tatercart.entity.minecart.storage.ShulkerMinecartEntity) ColoredMinecartEntity(eu.pb4.tatercart.entity.minecart.other.ColoredMinecartEntity) BarrelMinecartEntity(eu.pb4.tatercart.entity.minecart.storage.BarrelMinecartEntity) DropperMinecartEntity(eu.pb4.tatercart.entity.minecart.storage.DropperMinecartEntity) SlimeMinecartEntity(eu.pb4.tatercart.entity.minecart.other.SlimeMinecartEntity) AbstractMinecartEntity(net.minecraft.entity.vehicle.AbstractMinecartEntity) DispenserMinecartEntity(eu.pb4.tatercart.entity.minecart.storage.DispenserMinecartEntity) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

ColoredMinecartEntity (eu.pb4.tatercart.entity.minecart.other.ColoredMinecartEntity)1 SlimeMinecartEntity (eu.pb4.tatercart.entity.minecart.other.SlimeMinecartEntity)1 BarrelMinecartEntity (eu.pb4.tatercart.entity.minecart.storage.BarrelMinecartEntity)1 DispenserMinecartEntity (eu.pb4.tatercart.entity.minecart.storage.DispenserMinecartEntity)1 DropperMinecartEntity (eu.pb4.tatercart.entity.minecart.storage.DropperMinecartEntity)1 ShulkerMinecartEntity (eu.pb4.tatercart.entity.minecart.storage.ShulkerMinecartEntity)1 AbstractMinecartEntity (net.minecraft.entity.vehicle.AbstractMinecartEntity)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1