当前位置: 首页>>代码示例>>Java>>正文


Java IParticleFactory类代码示例

本文整理汇总了Java中net.minecraft.client.particle.IParticleFactory的典型用法代码示例。如果您正苦于以下问题:Java IParticleFactory类的具体用法?Java IParticleFactory怎么用?Java IParticleFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IParticleFactory类属于net.minecraft.client.particle包,在下文中一共展示了IParticleFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: registerParticleTypes

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@Nullable
public static EnumParticleTypes registerParticleTypes(String name, Class factory, boolean ignoreRange) throws Exception {
	AlchemyModLoader.checkState();
	int id = EnumParticleTypes.values().length;
	if (Always.runOnClient())
		if (Tool.isInstance(IParticleFactory.class, factory))
			Minecraft.getMinecraft().effectRenderer.registerParticle(id, (IParticleFactory) factory.newInstance());
		else 
			AlchemyRuntimeException.onException(new RuntimeException(
					"Class<" + factory.getName() + "> forgot to implement the Interface<" + IParticleFactory.class.getName() + "> ?"));
	EnumParticleTypes type = EnumHelper.addEnum(EnumParticleTypes.class, name,
			new Class[] { String.class, int.class, boolean.class }, name, id, ignoreRange);
	EnumParticleTypes.PARTICLES.put(type.getParticleID(), type);
	EnumParticleTypes.BY_NAME.put(type.getParticleName(), type);
	return type;
}
 
开发者ID:NekoCaffeine,项目名称:Alchemy,代码行数:17,代码来源:AlchemyFXType.java

示例2: spawnParticles

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void spawnParticles() {
    IParticleFactory particleFactory = new ModParticles.Factory();

    long worldTime = getEntityWorld().getTotalWorldTime();
    if (worldTime % 8 == 0) {
        double initialYSpeed = 0.05D;

        Vec3d forwardVec = getForward();
        Vec3d speedVec = new Vec3d(0, -forwardVec.y * 0.10 + initialYSpeed, 0);
        float yPos = (float) this.getEntityBoundingBox().minY;

        for (int j = 0; j < 2; ++j) {
            float xPos = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width;
            float zPos = (this.rand.nextFloat() * 2.0F - 1.0F) * this.width;
            Particle particle = particleFactory.createParticle(ModParticles.WOLF_IDLE_SMOKE, getEntityWorld(), this.posX + (double) xPos, (double) (yPos + 0.1F), this.posZ + (double) zPos, speedVec.x, speedVec.y, speedVec.z);
            Minecraft.getMinecraft().effectRenderer.addEffect(particle);
        }
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:21,代码来源:EntitySpiritWolf.java

示例3: syncroniseParticlesRegistry

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
/**
 * Initialises particle IDs and loads them into the vanilla registry for external API support.
 * @param mapping	Mapping of pre-registered vanilla Particles
 *
 * @return A new, or previously cached, mapping with all custom particles added.
 */
//FIXME: This has to be linked up at the bottom of EffectRenderer.func_178930_c(). There might be a better place for this method though.
public static Map<Integer, IParticleFactory> syncroniseParticlesRegistry(Map<Integer, IParticleFactory> mapping) {
	if (vanillaRegistry == null || !vanillaRegistry.equals(mapping)) {
		vanillaRegistry = mapping;
		int injected = 0;
		Iterator<IParticle> types = particlesRegistry.iterator();
		for (int i = 0; types.hasNext();) {
			if (mapping.containsKey(i)) {
				i++;
			} else {
				ParticleTypeClient type = (ParticleTypeClient)types.next();
				if (!particleIds.containsValue(type)) {
					mapping.put(i, type.getFactory());
					particleIds.put(i, type.setId(i));
					i++;
				} else {
					if (!mapping.containsKey(type.getId())) {
						mapping.put(type.getId(), type.getFactory());
					}
				}
			}
		}
	}
	return vanillaRegistry;
}
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:32,代码来源:ParticlesRegisterClient.java

示例4: getParticleFactory

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IParticleFactory getParticleFactory() {
    if (factory == null) {
        factory = (particleID, worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters) -> createCustomParticle(worldIn, xCoordIn, yCoordIn, zCoordIn, xSpeedIn, ySpeedIn, zSpeedIn, parameters);
    }
    return factory;
}
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:9,代码来源:CustomParticleFactoryBase.java

示例5: createEntityFX

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
public EntityFX createEntityFX(net.minecraft.world.World world) {
	//Look up for particle factory and pass it into BWEntityFX
	IParticleFactory particleFactory = (IParticleFactory) FMLClientHandler.instance().getClient().effectRenderer.field_178932_g.get(particleID);
	EntityFX entity = particleFactory.getEntityFX(0, world, 0, 0, 0, 0, 0, 0, 0);
	WrapperEvent.BWEntityFXCreate event = new WrapperEvent.BWEntityFXCreate(this, entity);
	Game.events().publish(event);
	return entity;
}
 
开发者ID:NOVA-Team,项目名称:NOVA-Core,代码行数:9,代码来源:BWEntityFX.java

示例6: spawnParticlesOnLanding

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void spawnParticlesOnLanding() {
	int i = getSlimeSize();
	float r = 1.0F, g = 1.0F, b = 1.0F;
	switch(getType()) {
	case RED: r = 0.65F; g = 0.25F; b = 0.3F; break;
	case BLUE: r = 0.25F; g = 0.4F; b = 0.75F; break;
	case YELLOW: g = 0.65F; b = 0.0F; break;
	default:
	}
	for (int j = 0; j < i * 8; ++j) {
		float f = rand.nextFloat() * (float) Math.PI * 2.0F;
		float f1 = rand.nextFloat() * 0.5F + 0.5F;
		float f2 = MathHelper.sin(f) * (float) i * 0.5F * f1;
		float f3 = MathHelper.cos(f) * (float) i * 0.5F * f1;
		// Need to use a factory to return the particle without automatically adding it to the effect renderer
		IParticleFactory factory = ClientProxy.particleFactoryMap.get(EnumParticleTypes.SLIME.getParticleID());
		// Alternate option: EntityBreakingFX.SlimeFactory factory = new EntityBreakingFX.SlimeFactory();
		if (factory != null) {
			EntityFX particle = factory.getEntityFX(EnumParticleTypes.SLIME.getParticleID(), worldObj, posX + (double) f2, getEntityBoundingBox().minY, posZ + (double) f3, 0, 0, 0);
			if (particle != null) {
				particle.setRBGColorF(r, g, b);
				WorldUtils.spawnWorldParticles(worldObj, particle);
			}
		}
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:28,代码来源:EntityChu.java

示例7: init

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@Override
public void init() {
	AntiqueAtlasHelper.registerTextures();
	Object o = ReflectionHelper.getPrivateValue(EffectRenderer.class, Minecraft.getMinecraft().effectRenderer, 6);
	if (o instanceof Map) {
		particleFactoryMap = (Map<Integer, IParticleFactory>) o;
	}
}
 
开发者ID:coolAlias,项目名称:ZeldaSwordSkills,代码行数:9,代码来源:ClientProxy.java

示例8: spawnParticle

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
public void spawnParticle(ParticleData particle, World world) {
  	if (particle.getType() == ParticleType.NONE) return;
  	
  	Minecraft mc = Minecraft.getMinecraft();
if (mc != null && mc.getRenderViewEntity() != null && mc.effectRenderer != null) {
          int particleSetting = mc.gameSettings.particleSetting;

          if (particleSetting == 1 && mc.theWorld.rand.nextInt(3) == 0) {
          	particleSetting = 2;
          }
          
          IParticleFactory factory = ((ParticleTypeClient)particle.getType()).getFactory();
          try {
           if (particle.getIgnoreDistance()) {
           	spawnCustomParticle(particle, factory, world);
           } else {
  	            double disX = mc.getRenderViewEntity().posX - particle.posX;
  	            double disY = mc.getRenderViewEntity().posY - particle.posY;
  	            double disZ = mc.getRenderViewEntity().posZ - particle.posZ;
               if (disX * disX + disY * disY + disZ * disZ <= particle.getMaxRenderDistance() && particleSetting <= 1) {
               	spawnCustomParticle(particle, factory, world);
               }
           }
          } catch (Throwable e) {
          	reportParticleError(e, factory, particle.getType(), particle.posX, particle.posY, particle.posZ, particle.getArgs());
          }
      }
  }
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:29,代码来源:ParticlesRegisterClient.java

示例9: reportParticleError

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
private void reportParticleError(Throwable e, IParticleFactory factory, IParticle particle, final double x, final double y, final double z, int[] args) {
	CrashReport report = CrashReport.makeCrashReport(e, "Exception while adding custom particle");
    CrashReportCategory category = report.makeCategory("Particle being added");
	category.addCrashSection("ID", particle.getId());
	category.addCrashSection("Particle Factory Class", factory == null ? "Null" : factory.getClass().toString());
	
    if (args != null && args.length > 0) category.addCrashSection("Parameters", args);
    category.addCrashSectionCallable("Position", new Callable() {
        public String call() {
            return CrashReportCategory.getCoordinateInfo(x, y, z);
        }
    });
    throw new ReportedException(report);
}
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:15,代码来源:ParticlesRegisterClient.java

示例10: getParticleFactory

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
IParticleFactory getParticleFactory();
 
开发者ID:AtomicBlom,项目名称:ShearMadness,代码行数:3,代码来源:ICustomParticleFactory.java

示例11: spawnParticles

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void spawnParticles(ItemStack stack, World world, EntityPlayer player) {
    long worldTime = world.getWorldTime();

    if (spawnParticles) {
        IParticleFactory particleFactory = new ParticleBlockDust.Factory();

        Vec3d posEyes = player.getPositionEyes(1.0f);
        RayTraceResult rayTraceResult = world.rayTraceBlocks(posEyes, posEyes.add(player.getLookVec().scale(3f)));

        if (rayTraceResult != null) {
            BlockPos pos = rayTraceResult.getBlockPos();
            Block targetBlock = BlockUtils.getBlock(world, pos);

            if (targetBlock != null
                    && targetBlock instanceof TotemWoodBlock) {
                IBlockState state = world.getBlockState(pos);
                int i = 4;

                for (int j = 0; j < 4; ++j) {
                    for (int k = 0; k < 4; ++k) {
                        for (int l = 0; l < 4; ++l) {
                            double d0 = ((double) j + 0.5D) / 4.0D;
                            double d1 = ((double) k + 0.5D) / 4.0D;
                            double d2 = ((double) l + 0.5D) / 4.0D;

                            double speedX = d0 - 0.5D;
                            double speedY = d1 - 0.5D;
                            double speedZ = d2 - 0.5D;
                            speedX *= 0.2;
                            speedY *= 0.2;
                            speedZ *= 0.2;
                            Minecraft.getMinecraft().effectRenderer.addEffect(
                                    particleFactory.createParticle(EnumParticleTypes.BLOCK_DUST.getParticleID(),
                                            world,
                                            (double) pos.getX() + d0,
                                            (double) pos.getY() + d1,
                                            (double) pos.getZ() + d2,
                                            speedX,
                                            speedY,
                                            speedZ,
                                            new int[]{Block.getStateId(state)}));
                        }
                    }
                }
            }
        }
        spawnParticles = false;
    }
}
 
开发者ID:CorwinJV,项目名称:MobTotems,代码行数:51,代码来源:CarvingKnife.java

示例12: setFactory

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
public IParticle setFactory(IParticle particle, Object factory) {
	return ((ParticleTypeClient)particle).setFactory((IParticleFactory)factory);
}
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:4,代码来源:ParticlesRegisterClient.java

示例13: spawnCustomParticle

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
private void spawnCustomParticle(ParticleData particle, IParticleFactory factory, World world) {
	addEffectToRenderer(factory.getEntityFX(particle.getType().getId(), world, particle.posX, particle.posY, particle.posZ, particle.velX, particle.velY, particle.velZ, particle.getArgs()));
}
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:4,代码来源:ParticlesRegisterClient.java

示例14: getVanillaParticleRegistry

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
private Map<Integer, IParticleFactory> getVanillaParticleRegistry() {
	return Minecraft.getMinecraft().effectRenderer.particleTypes;
}
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:4,代码来源:ParticlesRegisterClient.java

示例15: setFactory

import net.minecraft.client.particle.IParticleFactory; //导入依赖的package包/类
protected final ParticleTypeClient setFactory(IParticleFactory factory) {
	if (particleFactory == null) {
		particleFactory = factory;
	}
	return this;
}
 
开发者ID:warriordog,项目名称:BlazeLoader,代码行数:7,代码来源:ParticleTypeClient.java


注:本文中的net.minecraft.client.particle.IParticleFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。