tutorial:projectiles
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revisionNext revisionBoth sides next revision | ||
tutorial:projectiles [2020/11/16 19:47] – created spxctreofficial | tutorial:projectiles [2020/11/16 22:05] – fixing my idiotic mistakes spxctreofficial | ||
---|---|---|---|
Line 202: | Line 202: | ||
*/ | */ | ||
if (!world.isClient) { | if (!world.isClient) { | ||
- | SnowballEntity | + | PackedSnowballEntity |
snowballEntity.setItem(itemStack); | snowballEntity.setItem(itemStack); | ||
snowballEntity.setProperties(user, | snowballEntity.setProperties(user, | ||
Line 217: | Line 217: | ||
} | } | ||
</ | </ | ||
+ | Make sure that the projectile that you are launching with this item is indeed your custom '' | ||
+ | \\ | ||
Now, we are finished with creating an item for the '' | Now, we are finished with creating an item for the '' | ||
\\ | \\ | ||
Line 244: | Line 245: | ||
===== Rendering your Projectile Entity ===== | ===== Rendering your Projectile Entity ===== | ||
- | Your projectile entity is now defined and registered, but we are not done. Without a renderer, the '' | + | Your projectile entity is now defined and registered, but we are not done. Without a renderer, the '' |
+ | \\ | ||
+ | Before we start, we will quickly define an Identifier that we will be using a lot: our PacketID. | ||
+ | <code java> | ||
+ | public static final Identifier PacketID = new Identifier(ProjectileTutorialMod.ModID, | ||
+ | </ | ||
\\ | \\ | ||
First on the list, we should get the '' | First on the list, we should get the '' | ||
Line 356: | Line 362: | ||
<code java [enable_line_numbers=" | <code java [enable_line_numbers=" | ||
public void receiveEntityPacket() { | public void receiveEntityPacket() { | ||
- | ClientSidePacketRegistry.INSTANCE.register(new Identifier(ProjectileTutorialMod.ModID, | + | ClientSidePacketRegistry.INSTANCE.register(PacketID, (ctx, byteBuf) -> { |
EntityType<?> | EntityType<?> | ||
UUID uuid = byteBuf.readUuid(); | UUID uuid = byteBuf.readUuid(); | ||
Line 378: | Line 384: | ||
}); | }); | ||
}); | }); | ||
+ | } | ||
+ | </ | ||
+ | |||
+ | Back in our '' | ||
+ | <code java [enable_line_numbers=" | ||
+ | @Override | ||
+ | public Packet createSpawnPacket() { | ||
+ | return EntitySpawnPacket.create(this, | ||
} | } | ||
</ | </ | ||
Line 395: | Line 409: | ||
Now, your projectile should be working in-game! Just make sure your textures are in the right place, and your item and projectile should be working. | Now, your projectile should be working in-game! Just make sure your textures are in the right place, and your item and projectile should be working. | ||
+ | |||
+ | [INSERT USABLE PICTURE HERE] |
tutorial/projectiles.txt · Last modified: 2024/03/08 01:56 by netuserget