【发布时间】:2019-08-01 22:23:09
【问题描述】:
我已经研究了一段时间了,
我正在尝试制作我自己的粒子,但我在弄清楚一切如何注册以及如何让我的粒子被称为 modid:particle 时遇到问题,因此基本上将其注册到我的 mod。
另外,如果有人可以帮助我计算数学,我希望我的粒子从块内缓慢移动到原始块上方约 0.5 块。
我已经尝试了很多,要列出所有内容将是疯狂的。然而,我确实设法让熔岩粒子出现,我尝试了不同的数学,产生粒子的不同选项,我修改为在 1.14 中工作的旧方法,但不管它说什么“命名 minecraft:enchantblack 进入太晚了”
做他所做的不是一个选择!我必须找到自己的方法来做同样的事情。因为我的粒子不一样。
我希望粒子以不同的大小出现,从而使块看起来像是神奇的。
当我尝试我的方块时,游戏立即崩溃
如果您要求,我会添加任何信息!如果您更愿意解释我如何进行数学运算或向我推荐数学资源,我会很乐意接受这些!我能做的任何事情都可以让我进步,我并不特别需要你为我做。我只是需要一些帮助来指导自己!
protected EnchantedBlack(World world, double x, double y, double z) {
super(world, x, y, z, 0.0D, 0.0D, 0.0D);
this.motionX *= 0;
this.motionY *= 0.800000011920929D;
this.motionZ *= 0;
this.motionY = (double) (this.rand.nextFloat() * 0.4F + 0.05F);
this.particleScale *= this.rand.nextFloat() * 2.0F + 0.2F;
this.maxAge = (int) (16.0D / (Math.random() * 0.8D + 0.2D));
}
public void tick() {
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
float f = (float)this.age / (float)this.maxAge;
if (this.age++ >= this.maxAge) {
this.setExpired();
} else {
this.motionY -= 0.03D;
this.move(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.1D;
this.motionY *= 0.9990000128746033D;
this.motionZ *= 0.1D;
if (this.onGround) {
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
}
}
public IParticleRenderType getRenderType() {
return IParticleRenderType.PARTICLE_SHEET_OPAQUE;
}
public float getScale(float float1) {
float f = ((float)this.age + float1) / (float)this.maxAge;
return this.particleScale * (1.0F - f * f);
}
@OnlyIn(Dist.CLIENT)
public static class Factory implements IParticleFactory<BasicParticleType> {
private final IAnimatedSprite spriteSet;
public Factory(IAnimatedSprite p_i50495_1_) {
this.spriteSet = p_i50495_1_;
}
public Particle makeParticle(BasicParticleType typeIn, World worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
EnchantedBlack enchantedblack = new EnchantedBlack(worldIn, x, y, z);
enchantedblack.selectSpriteRandomly(this.spriteSet);
return enchantedblack;
}
}
}
【问题讨论】:
标签: java math minecraft particles minecraft-forge