Disable lightning strike for the ruby, add a couple more things to do.
Some checks failed
build / build (17, ubuntu-22.04) (push) Has been cancelled
build / build (17, windows-2022) (push) Has been cancelled
build / build (21, ubuntu-22.04) (push) Has been cancelled
build / build (21, windows-2022) (push) Has been cancelled

This commit is contained in:
kelson8 2024-03-24 03:51:42 -04:00
parent 77aacef8cb
commit 97a6028c62
Signed by: kelson8
GPG Key ID: 3D738D9DD7239E13
2 changed files with 26 additions and 16 deletions

View File

@ -32,23 +32,25 @@ public class KelsonCraftTestClient implements ClientModInitializer {
// Code below came from https://www.reddit.com/r/fabricmc/comments/qyt3jg/comment/hls4vep/
// This works, but it doesn't show the lightning strike.
// I forgot I set this up, I have disabled it for now. I would like to have a command /lightning with an alias to /smite.
// This runs whenever a player right clicks with the ruby, which is set in the if statement
UseItemCallback.EVENT.register((player, world, unused) ->{
ItemStack mainHandItem = player.getMainHandStack(); // Get the item the player is holding in their main hand.
if(player.getMainHandStack().getName().equals(Text.translatable("item.kelsoncraft-test.ruby")) && !player.isSpectator()){ // Check if item is a ruby, and if the player is not in spectator mode.
LightningEntity lightning = new LightningEntity(EntityType.LIGHTNING_BOLT, world); // Create the lightning bolt.
world.spawnEntity(lightning); // Spawn the lightning entity
//player.set
// This is how to get the player position
Vec3d playerPos = player.getPos();
//player.sendMessage(Text.of("Your coords are X: " + playerPos.x + " Y: " + playerPos.y + " Z: " + playerPos.z));
// This might be a way to make the lightning render in, I'm not sure how to use the EntityRendererFactory.Context()
//LightningEntityRenderer lightning1 = new LightningEntityRenderer(new EntityRendererFactory.Context());
}
return TypedActionResult.success(mainHandItem, true); // Return success and swing hand to show item use.
});
// UseItemCallback.EVENT.register((player, world, unused) ->{
// ItemStack mainHandItem = player.getMainHandStack(); // Get the item the player is holding in their main hand.
// if(player.getMainHandStack().getName().equals(Text.translatable("item.kelsoncraft-test.ruby")) && !player.isSpectator()){ // Check if item is a ruby, and if the player is not in spectator mode.
// LightningEntity lightning = new LightningEntity(EntityType.LIGHTNING_BOLT, world); // Create the lightning bolt.
// world.spawnEntity(lightning); // Spawn the lightning entity
//
// //player.set
// // This is how to get the player position
// Vec3d playerPos = player.getPos();
// //player.sendMessage(Text.of("Your coords are X: " + playerPos.x + " Y: " + playerPos.y + " Z: " + playerPos.z));
//
// // This might be a way to make the lightning render in, I'm not sure how to use the EntityRendererFactory.Context()
// //LightningEntityRenderer lightning1 = new LightningEntityRenderer(new EntityRendererFactory.Context());
// }
// return TypedActionResult.success(mainHandItem, true); // Return success and swing hand to show item use.
// });
// This entrypoint is suitable for setting up client-specific logic, such as rendering.
}
}

View File

@ -15,6 +15,14 @@ import static net.minecraft.server.command.CommandManager.*;
// Todo Possibly hook into other mods and find some library mods to mess around with.
// Link for library mods: https://github.com/Siphalor/awesome-fabric
// Todo Try to use Disguise Lib for disguises
// Link: https://github.com/NucleoidMC/DisguiseLib
// Todo Look into Grand Economy once it updates to 1.20
// https://www.curseforge.com/minecraft/mc-mods/grand-economy
// Todo Try to setup /skull command that gives the players their head, idea from item/SkullItem
public class KelsonCraftTest implements ModInitializer {
// Todo Change name of project to something else