Search in sources :

Example 1 with EntityTemporalItem

use of arekkuusu.solar.common.entity.EntityTemporalItem in project Solar by ArekkuusuJerii.

the class TileQSquared method map.

private EntityTemporalItem map(EntityItem entity) {
    if (entity instanceof EntityTemporalItem) {
        ((EntityTemporalItem) entity).lifeTime = 10;
        return (EntityTemporalItem) entity;
    }
    EntityTemporalItem item = new EntityTemporalItem(entity);
    item.setMotion(entity.motionX, entity.motionY, entity.motionZ);
    item.setMotionRest(0.85F);
    world.spawnEntity(item);
    entity.setDead();
    return item;
}
Also used : EntityTemporalItem(arekkuusu.solar.common.entity.EntityTemporalItem)

Example 2 with EntityTemporalItem

use of arekkuusu.solar.common.entity.EntityTemporalItem in project Solar by ArekkuusuJerii.

the class TileVacuumConveyor method map.

private EntityTemporalItem map(EntityItem entity) {
    if (entity instanceof EntityTemporalItem) {
        ((EntityTemporalItem) entity).lifeTime = 360;
        return (EntityTemporalItem) entity;
    }
    EntityTemporalItem item = new EntityTemporalItem(entity);
    world.spawnEntity(item);
    entity.setDead();
    return item;
}
Also used : EntityTemporalItem(arekkuusu.solar.common.entity.EntityTemporalItem)

Example 3 with EntityTemporalItem

use of arekkuusu.solar.common.entity.EntityTemporalItem in project Solar by ArekkuusuJerii.

the class TileVacuumConveyor method dropItems.

private void dropItems() {
    if (cooldown <= 0) {
        IItemHandler handler = from.getKey();
        ISidedInventory sidedInv = from.getValue();
        for (int slot = 0; slot < handler.getSlots(); slot++) {
            ItemStack inSlot = handler.getStackInSlot(slot);
            if (!inSlot.isEmpty() && (lookup.isEmpty() || ItemHandlerHelper.canItemStacksStack(lookup, inSlot)) && (sidedInv == null || sidedInv.canExtractItem(slot, inSlot, getFacingLazy()))) {
                BlockPos offset = pos.offset(getFacingLazy());
                Vector3 spawn = Vector3.apply(offset.getX(), offset.getY(), offset.getZ()).add(0.5D);
                ItemStack out = handler.extractItem(slot, Integer.MAX_VALUE, false);
                EntityTemporalItem entity = new EntityTemporalItem(world, spawn.x(), spawn.y(), spawn.z(), out);
                impulseEntityItem(spawn, entity);
                world.spawnEntity(entity);
                break;
            }
        }
        cooldown = 5;
    } else
        cooldown--;
    applyGravity(repulse, -1.25D);
}
Also used : ISidedInventory(net.minecraft.inventory.ISidedInventory) IItemHandler(net.minecraftforge.items.IItemHandler) BlockPos(net.minecraft.util.math.BlockPos) Vector3(net.katsstuff.mirror.data.Vector3) EntityTemporalItem(arekkuusu.solar.common.entity.EntityTemporalItem) ItemStack(net.minecraft.item.ItemStack)

Aggregations

EntityTemporalItem (arekkuusu.solar.common.entity.EntityTemporalItem)3 Vector3 (net.katsstuff.mirror.data.Vector3)1 ISidedInventory (net.minecraft.inventory.ISidedInventory)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1 IItemHandler (net.minecraftforge.items.IItemHandler)1