tutorial:projectiles
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tutorial:projectiles [2022/09/29 14:37] – Remove spawn packet code, since createSpawnPacket is already overriden by ProjectileEntity. patrickmsm | tutorial:projectiles [2024/03/08 01:56] (current) – [Creating & Registering a Projectile Entity] Update names, add @Override, and change some parameters to match 1.20.4 yarn netuserget | ||
---|---|---|---|
Line 83: | Line 83: | ||
return null; // We will configure this later, once we have created the ProjectileItem. | return null; // We will configure this later, once we have created the ProjectileItem. | ||
} | } | ||
- | @Override | + | |
@Environment(EnvType.CLIENT) | @Environment(EnvType.CLIENT) | ||
Line 103: | Line 103: | ||
} | } | ||
+ | @Override | ||
protected void onEntityHit(EntityHitResult entityHitResult) { // called on entity hit. | protected void onEntityHit(EntityHitResult entityHitResult) { // called on entity hit. | ||
super.onEntityHit(entityHitResult); | super.onEntityHit(entityHitResult); | ||
Line 117: | Line 118: | ||
} | } | ||
- | protected void onCollision(HitResult hitResult) { // called on collision with a block | + | @Override |
- | super.onCollision(hitResult); | + | protected void onBlockCollision(BlockState state) { // called on collision with a block |
+ | super.onBlockCollision(state); | ||
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, | ||
Line 228: | Line 230: | ||
Finally, register your item. | Finally, register your item. | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
- | public static final Item PackedSnowballItem = new PackedSnowballItem(new Item.Settings().group(ItemGroup.MISC).maxCount(16)); | + | public static final Item PackedSnowballItem = new PackedSnowballItem(new Item.Settings().maxCount(16)); |
[...] | [...] |
tutorial/projectiles.1664462266.txt.gz · Last modified: 2022/09/29 14:37 by patrickmsm