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);
}
}
}
}
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();
}
}
Aggregations