Search in sources :

Example 1 with IEntityFilterItem

use of lumien.randomthings.lib.IEntityFilterItem in project Random-Things by lumien231.

the class RTEventHandler method spawnEntityFilterParticles.

@SideOnly(Side.CLIENT)
private void spawnEntityFilterParticles(LivingUpdateEvent event) {
    EntityPlayer player = Minecraft.getMinecraft().player;
    ItemStack equipped = player.getHeldItemMainhand();
    if (!equipped.isEmpty() && equipped.getItem() instanceof IEntityFilterItem) {
        IEntityFilterItem filterInstance = (IEntityFilterItem) equipped.getItem();
        if (filterInstance.apply(equipped, event.getEntityLiving())) {
            for (int i = 0; i < 1; ++i) {
                Particle particle = Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.PORTAL.ordinal(), event.getEntityLiving().posX + (RTEventHandler.rng.nextDouble() - 0.5D) * event.getEntityLiving().width, event.getEntityLiving().posY + RTEventHandler.rng.nextDouble() * event.getEntityLiving().height - 0.25D, event.getEntityLiving().posZ + (RTEventHandler.rng.nextDouble() - 0.5D) * event.getEntityLiving().width, (RTEventHandler.rng.nextDouble() - 0.5D) * 2.0D, -RTEventHandler.rng.nextDouble(), (RTEventHandler.rng.nextDouble() - 0.5D) * 2.0D);
                particle.setRBGColorF(0.2F, 0.2F, 1);
            }
        }
    }
}
Also used : Particle(net.minecraft.client.particle.Particle) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ItemStack(net.minecraft.item.ItemStack) IEntityFilterItem(lumien.randomthings.lib.IEntityFilterItem) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 2 with IEntityFilterItem

use of lumien.randomthings.lib.IEntityFilterItem in project Random-Things by lumien231.

the class TileEntityFilteredRedirectorPlate method onInventoryChanged.

@Override
public void onInventoryChanged(IInventory inventory) {
    ItemStack f1 = inventory.getStackInSlot(0);
    ItemStack f2 = inventory.getStackInSlot(1);
    if (!f1.isEmpty() && f1.getItem() instanceof IEntityFilterItem) {
        filter[0] = new EntityFilterItemStack(f1, (IEntityFilterItem) f1.getItem());
    } else {
        filter[0] = null;
    }
    if (!f2.isEmpty() && f2.getItem() instanceof IEntityFilterItem) {
        filter[1] = new EntityFilterItemStack(f2, (IEntityFilterItem) f2.getItem());
    } else {
        filter[1] = null;
    }
    if (!reading) {
        this.syncTE();
    }
}
Also used : EntityFilterItemStack(lumien.randomthings.lib.EntityFilterItemStack) EntityFilterItemStack(lumien.randomthings.lib.EntityFilterItemStack) ItemStack(net.minecraft.item.ItemStack) IEntityFilterItem(lumien.randomthings.lib.IEntityFilterItem)

Aggregations

IEntityFilterItem (lumien.randomthings.lib.IEntityFilterItem)2 ItemStack (net.minecraft.item.ItemStack)2 EntityFilterItemStack (lumien.randomthings.lib.EntityFilterItemStack)1 Particle (net.minecraft.client.particle.Particle)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1