tutorial:projectiles
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:projectiles [2020/11/16 22:17] – tutorial-download spxctreofficial | tutorial:projectiles [2021/09/20 06:27] – Entity#remove() -> kill() and small java 16 changes upcraftlp | ||
---|---|---|---|
Line 108: | Line 108: | ||
entity.damage(DamageSource.thrownProjectile(this, | entity.damage(DamageSource.thrownProjectile(this, | ||
- | if (entity instanceof LivingEntity) { // checks if entity is an instance of LivingEntity (meaning it is not a boat or minecart) | + | if (entity instanceof LivingEntity |
- | ((LivingEntity) entity).addStatusEffect((new StatusEffectInstance(StatusEffects.BLINDNESS, | + | livingEntity.addStatusEffect((new StatusEffectInstance(StatusEffects.BLINDNESS, |
- | ((LivingEntity) entity).addStatusEffect((new StatusEffectInstance(StatusEffects.SLOWNESS, | + | livingEntity.addStatusEffect((new StatusEffectInstance(StatusEffects.SLOWNESS, |
- | ((LivingEntity) entity).addStatusEffect((new StatusEffectInstance(StatusEffects.POISON, | + | livingEntity.addStatusEffect((new StatusEffectInstance(StatusEffects.POISON, |
- | entity.playSound(SoundEvents.AMBIENT_CAVE, | + | livingEntity.playSound(SoundEvents.AMBIENT_CAVE, |
} | } | ||
} | } | ||
Line 120: | Line 120: | ||
if (!this.world.isClient) { // checks if the world is client | if (!this.world.isClient) { // checks if the world is client | ||
this.world.sendEntityStatus(this, | this.world.sendEntityStatus(this, | ||
- | this.remove(); // kills the projectile | + | this.kill(); // kills the projectile |
} | } | ||
Line 256: | Line 256: | ||
@Override | @Override | ||
public void onInitializeClient() { | public void onInitializeClient() { | ||
- | EntityRendererRegistry.INSTANCE.register(ProjectileTutorialMod.PackedSnowballEntityType, | + | EntityRendererRegistry.INSTANCE.register(ProjectileTutorialMod.PackedSnowballEntityType, |
- | new FlyingItemEntityRenderer(dispatcher, | + | new FlyingItemEntityRenderer(context)); |
[. . .] | [. . .] | ||
} | } | ||
Line 276: | Line 276: | ||
PacketBufUtil.writeAngle(byteBuf, | PacketBufUtil.writeAngle(byteBuf, | ||
PacketBufUtil.writeAngle(byteBuf, | PacketBufUtil.writeAngle(byteBuf, | ||
- | return | + | return |
} | } | ||
public static final class PacketBufUtil { | public static final class PacketBufUtil { | ||
Line 400: | Line 400: | ||
@Override | @Override | ||
public void onInitializeClient() { | public void onInitializeClient() { | ||
- | EntityRendererRegistry.INSTANCE.register(ProjectileTutorialMod.PackedSnowballEntityType, | + | EntityRendererRegistry.INSTANCE.register(ProjectileTutorialMod.PackedSnowballEntityType, |
- | new FlyingItemEntityRenderer(dispatcher, | + | new FlyingItemEntityRenderer(context)); |
receiveEntityPacket(); | receiveEntityPacket(); | ||
} | } |
tutorial/projectiles.txt · Last modified: 2024/03/08 01:56 by netuserget