本文整理汇总了Java中net.minecraft.client.particle.ParticleManager类的典型用法代码示例。如果您正苦于以下问题:Java ParticleManager类的具体用法?Java ParticleManager怎么用?Java ParticleManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ParticleManager类属于net.minecraft.client.particle包,在下文中一共展示了ParticleManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addDestroyEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager)
{
final IStructureTE te = (IStructureTE) world.getTileEntity(pos);
if (te != null)
{
final StructureBlock block = te.getMasterBlockInstance();
if (block != null)
{
return block.addDestroyEffects(world, te.getMasterBlockLocation(), particleManager);
}
}
return true; //No Destroy Effects
}
示例2: onMessage
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@SuppressWarnings({"ReturnOfNull", "ConstantConditions"})
@Override
public IMessage onMessage(SpawnCustomParticleMessage message, MessageContext ctx)
{
final ParticleManager effectRenderer = Minecraft.getMinecraft().effectRenderer;
final IForgeRegistry<ICustomParticleFactory> registry = GameRegistry.findRegistry(ICustomParticleFactory.class);
final ICustomParticleFactory factory = registry.getValue(message.getParticleResourceLocation());
final Particle particle = factory.getParticleFactory().createParticle(-1,
Minecraft.getMinecraft().thePlayer.worldObj,
message.getXCoordinate(),
message.getYCoordinate(),
message.getZCoordinate(),
message.getParticleSpeed(),
message.getParticleSpeed(),
message.getParticleSpeed(),
message.getParticleArgs()
);
effectRenderer.addEffect(particle);
return null;
}
示例3: handleDestroyEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
/**
* {@link Block#addHitEffects}
* Provided the model bound is an instance of IModelParticleProvider, you will have landing particles just handled for you.
* Use the default PerspectiveModel implementations inside CCL, Destroy effects will just be handled for you.
*
* @param world The world.
* @param pos The position of the block.
* @param manager The ParticleManager.
* @return True if particles were added, basically just return the result of this method inside {@link Block#addHitEffects}
*/
@SideOnly (Side.CLIENT)
public static boolean handleDestroyEffects(World world, BlockPos pos, ParticleManager manager) {
IBlockState state = world.getBlockState(pos);
BlockModelShapes modelProvider = Minecraft.getMinecraft().getBlockRendererDispatcher().getBlockModelShapes();
try {
state = state.getActualState(world, pos);
} catch (Throwable ignored) {
}
IBakedModel model = modelProvider.getModelForState(state);
state = state.getBlock().getExtendedState(state, world, pos);
if (model instanceof IModelParticleProvider) {
Cuboid6 bounds = new Cuboid6(state.getBoundingBox(world, pos));
Set<TextureAtlasSprite> destroySprites = ((IModelParticleProvider) model).getDestroyEffects(state, world, pos);
List<TextureAtlasSprite> sprites = destroySprites.stream().filter(sprite -> !ignoredParticleSprites.contains(sprite)).collect(Collectors.toList());
addBlockDestroyEffects(world, bounds.add(pos), sprites, manager);
return true;
}
return false;
}
示例4: spawnBreakParticles
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
/**
* Spawns the break particles for a block, similarly to the normal block break effect
* particle. The intended use of this method is to override the block break effects.
*
* @param manager The EffectRenderer, used to render the particle effect.
* @param state The BlockState for the block to render the breaking effect of.
* @param world The World to spawn the particle effect in.
* @param pos The position to spawn the particles at.
* @return boolean Whether or not the effect actually spawned.
*/
public static boolean spawnBreakParticles (ParticleManager manager, IBlockState state, World world, BlockPos pos) {
if (state.getBlock() != null) {
final int multiplier = 4;
for (int xOffset = 0; xOffset < multiplier; xOffset++)
for (int yOffset = 0; yOffset < multiplier; yOffset++)
for (int zOffset = 0; zOffset < multiplier; zOffset++) {
final double xPos = pos.getX() + (xOffset + 0.5D) / multiplier;
final double yPos = pos.getY() + (yOffset + 0.5D) / multiplier;
final double zPos = pos.getZ() + (zOffset + 0.5D) / multiplier;
manager.addEffect(new ParticleDiggingOpen(world, xPos, yPos, zPos, xPos - pos.getX() - 0.5D, yPos - pos.getY() - 0.5D, zPos - pos.getZ() - 0.5D, state).setBlockPos(pos));
}
return true;
}
return false;
}
示例5: spawnBreakParticles
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
/**
* Spawns the break particles for a block, similarly to the normal block break effect
* particle. The intended use of this method is to override the block break effects.
*
* @param manager The EffectRenderer, used to render the particle effect.
* @param state The BlockState for the block to render the breaking effect of.
* @param world The World to spawn the particle effect in.
* @param pos The position to spawn the particles at.
* @return boolean Whether or not the effect actually spawned.
*/
@SideOnly(Side.CLIENT)
public static boolean spawnBreakParticles (ParticleManager manager, IBlockState state, World world, BlockPos pos) {
if (state.getBlock() != null) {
final int multiplier = 4;
for (int xOffset = 0; xOffset < multiplier; xOffset++) {
for (int yOffset = 0; yOffset < multiplier; yOffset++) {
for (int zOffset = 0; zOffset < multiplier; zOffset++) {
final double xPos = pos.getX() + (xOffset + 0.5D) / multiplier;
final double yPos = pos.getY() + (yOffset + 0.5D) / multiplier;
final double zPos = pos.getZ() + (zOffset + 0.5D) / multiplier;
manager.addEffect(new OpenParticleDigging(world, xPos, yPos, zPos, xPos - pos.getX() - 0.5D, yPos - pos.getY() - 0.5D, zPos - pos.getZ() - 0.5D, state).setBlockPos(pos));
}
}
}
return true;
}
return false;
}
示例6: addDestroyEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
IBlockState state = world.getBlockState(pos);
int i = 4;
for (int j = 0; j < i; ++j) {
for (int k = 0; k < i; ++k) {
for (int l = 0; l < i; ++l) {
double d0 = (double) pos.getX() + ((double) j + 0.5D) / (double) i;
double d1 = (double) pos.getY() + ((double) k + 0.5D) / (double) i;
double d2 = (double) pos.getZ() + ((double) l + 0.5D) / (double) i;
effectRenderer.addEffect((new EntityDiggingFXMoarSigns(world, d0, d1, d2, d0 - (double) pos.getX() - 0.5D, d1 - (double) pos.getY() - 0.5D, d2 - (double) pos.getZ() - 0.5D, pos, state)).setBlockPos(pos));
}
}
}
return true;
}
示例7: addBlockHitEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@SideOnly(Side.CLIENT)
private void addBlockHitEffects(@Nonnull World world, @Nonnull ParticleManager effectRenderer, double xCoord, double yCoord, double zCoord,
@Nonnull EnumFacing sideEnum, @Nonnull TextureAtlasSprite tex) {
double d0 = xCoord;
double d1 = yCoord;
double d2 = zCoord;
if (sideEnum.getAxis() != Axis.X) {
d0 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
}
if (sideEnum.getAxis() != Axis.Y) {
d1 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
}
if (sideEnum.getAxis() != Axis.Z) {
d2 += rand.nextDouble() * 0.4 - rand.nextDouble() * 0.4;
}
ParticleDigging digFX = (ParticleDigging) Minecraft.getMinecraft().effectRenderer.spawnEffectParticle(EnumParticleTypes.BLOCK_CRACK.getParticleID(), d0, d1,
d2, 0, 0, 0, 0);
if (digFX != null) {
digFX.init().multiplyVelocity(0.2F).multipleParticleScaleBy(0.6F);
digFX.setParticleTexture(tex);
}
}
示例8: addHitEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Override
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager) {
if(world != null && pos != null)
if (world instanceof WorldServer)
((WorldServer)world).spawnParticle(EnumParticleTypes.CLOUD, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 20, 0.7, 0.7, 0.7, 0, new int[EnumParticleTypes.CLOUD.getArgumentCount()]);
return super.addHitEffects(state, worldObj, target, manager);
}
示例9: addHitEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Override
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager) {
if(world != null && pos != null)
if (world instanceof WorldServer)
((WorldServer)world).spawnParticle(EnumParticleTypes.CLOUD, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 4, 0.7, 0.8, 0.6, 0, new int[EnumParticleTypes.CLOUD.getArgumentCount()]);
return super.addHitEffects(state, worldObj, target, manager);
}
示例10: addHitEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Override
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, ParticleManager manager) {
if(world != null && pos != null)
if (world instanceof WorldServer)
((WorldServer)world).spawnParticle(EnumParticleTypes.SMOKE_NORMAL, false, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, 6, 0.5, 0.5, 0.6, 0, new int[EnumParticleTypes.SMOKE_NORMAL.getArgumentCount()]);
return super.addHitEffects(state, worldObj, target, manager);
}
示例11: addDestroyEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager)
{
final float scaleVec = 0.05f;
final TileEntity ute = world.getTileEntity(pos);
if (ute instanceof StructureTE)
{
final StructureTE te = (StructureTE) ute;
for (MutableBlockPos local : getPattern().getStructureItr())
{
//outward Vector
float xSpeed = 0.0f;
float ySpeed = 0.0f;
float zSpeed = 0.0f;
for (EnumFacing d : EnumFacing.VALUES)
{
if (!getPattern().hasBlockAt(local, d))
{
d = localToGlobal(d, te.getOrientation(), te.getMirror());
xSpeed += d.getFrontOffsetX();
ySpeed += d.getFrontOffsetY();
zSpeed += d.getFrontOffsetZ();
}
}
mutLocalToGlobal(local, pos, te.getOrientation(), te.getMirror(), getPattern().getBlockBounds());
spawnBreakParticle(world, te, local, xSpeed * scaleVec, ySpeed * scaleVec, zSpeed * scaleVec);
}
}
return true; //No Destroy Effects
}
示例12: addDestroyEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@SideOnly(Side.CLIENT)
@Override
public boolean addDestroyEffects(World world, BlockPos pos, ParticleManager effectRenderer) {
IBlockState state = world.getBlockState(pos);
if (state == null || state.getBlock() != this) {
return false;
}
state = state.getBlock().getActualState(state, world, pos);
int i = 4;
TextureAtlasSprite tex = null;
TileEntity tile = world.getTileEntity(pos);
if(Util.notNullAndInstanceOf(tile, TileEntityPipe.class)){
TileEntityPipe pipe = ((TileEntityPipe)tile);
tex = Minecraft.getMinecraft().getTextureMapBlocks().getAtlasSprite(pipe.getPipeType().getCoreTexture(pipe));
if(tex == null){
return false;
}
}
for (int j = 0; j < i; ++j) {
for (int k = 0; k < i; ++k) {
for (int l = 0; l < i; ++l) {
double d0 = pos.getX() + (j + 0.5D) / i;
double d1 = pos.getY() + (k + 0.5D) / i;
double d2 = pos.getZ() + (l + 0.5D) / i;
ParticleDigging fx = (ParticleDigging) new ParticleDigging.Factory().createParticle(-1, world, d0, d1, d2, d0 - pos.getX() - 0.5D,
d1 - pos.getY() - 0.5D, d2 - pos.getZ() - 0.5D, 0);
fx.setBlockPos(pos);
fx.setParticleTexture(tex);
effectRenderer.addEffect(fx);
}
}
}
return true;
}
示例13: spawnTwinkleParticles
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
private void spawnTwinkleParticles(ParticleManager renderer, World w, double x, double y, double z) {
for(int i = 0; i < 5; i++) {
TwinkleFX fx = new TwinkleFX(w, x, y, z, true);
fx.setOffset((Math.random() * 0.4) - 0.2, (Math.random() * 0.4) - 0.2, (Math.random() * 0.4) - 0.2);
fx.setNoClip(true);
fx.multipleParticleScaleBy(0.5F);
fx.randomizeSpeed();
fx.multiplyVelocity(0.02F);
fx.setAlphaEffect(true);
fx.setScaleEffect(true);
fx.setMaxAge(20);
fx.setAnimationTicks(20);
renderer.addEffect(fx);
}
}
示例14: addHitEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Deprecated//Use the new particle system.
@SideOnly (Side.CLIENT)
public static void addHitEffects(IBlockState state, World world, RayTraceResult trace, ParticleManager particleManager, IWorldBlockTextureProvider provider) {
TextureAtlasSprite sprite = provider.getTexture(trace.sideHit, state, BlockRenderLayer.SOLID, world, trace.getBlockPos());
Cuboid6 cuboid = new Cuboid6(state.getBoundingBox(world, trace.getBlockPos())).add(trace.getBlockPos());
addBlockHitEffects(world, cuboid, trace.sideHit, sprite, particleManager);
}
示例15: addDestroyEffects
import net.minecraft.client.particle.ParticleManager; //导入依赖的package包/类
@Deprecated//Use the new particle system.
@SideOnly (Side.CLIENT)
public static void addDestroyEffects(World world, BlockPos pos, ParticleManager particleManager, IWorldBlockTextureProvider provider) {
TextureAtlasSprite[] sprites = new TextureAtlasSprite[6];
IBlockState state = world.getBlockState(pos);
for (EnumFacing face : EnumFacing.VALUES) {
sprites[face.ordinal()] = provider.getTexture(face, state, BlockRenderLayer.SOLID, world, pos);
}
Cuboid6 cuboid = new Cuboid6(state.getBoundingBox(world, pos)).add(pos);
addBlockDestroyEffects(world, cuboid, sprites, particleManager);
}