Jump to content

Naamah

Members
  • Posts

    17
  • Joined

  • Last visited

Converted

  • Gender
    Female

Naamah's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. Thanks for the response. I ended up going with this: public class PlayerDeathHandler { @SubscribeEvent public void playerKilled(LivingDeathEvent event) { if (event.getEntity() instanceof Player player) { ItemStack poppetStack = new ItemStack(ModItems.DEATH_PROTECTION_POPPET.get()); if (player.getInventory().contains(poppetStack)) { event.setCanceled(true); player.setHealth(player.getMaxHealth()); for (int i = 0; i < player.getInventory().getContainerSize(); i++) { ItemStack stackInSlot = player.getInventory().getItem(i); if (stackInSlot.getItem() == poppetStack.getItem()) { stackInSlot.shrink(1); if (stackInSlot.isEmpty()) { player.getInventory().setItem(i, ItemStack.EMPTY); } break; } } } } } } It works like a charm, but are there any issues that COULD arise using this? I don't have much experience with Forge, so I'm not sure about the common issues and whatnot.
  2. You CAN add capes, but it requires that you create a custom model for the capes and use something like geckolib or another library that allows for wearable items with physics. You could try to find a tutorial on youtube for custom armor and follow along with that for inspiration in your code
  3. Hello, I've been trying to get this to work forever. I have some code that gives an item when a player joins and I've been using that as a base, but it hasn't been working. This is my current code: @SubscribeEvent public void playerKilled(LivingDeathEvent event){ if (event.getEntity() instanceof Player && !event.getEntity().isDeadOrDying()) { Player player = (Player) event.getEntity(); if (player.getInventory().contains(new ItemStack(ModItems.FIRE_PROTECTION_POPPET.get()))) { player.getInventory().removeItem(new ItemStack(ModItems.FIRE_PROTECTION_POPPET.get())); } } } In a sense, I am trying to "use up" the item when the player dies without them literally dying (like the totem of undying). I'm not exactly sure how to check the way the totem of undying works, but any tips would be appreciated.
  4. Hello, I am creating am mod that adds different "compressed" versions of blocks. I am trying to get each block to have an overlay that is different on each stage of compression. The issue I have is, I don't know how to get multiple layers to work. I have the code for the block which works, but I can't figure out how to format the model/block json file to get it to render with 1 layer overlaying the other. I have tried using something like this: ItemBlockRenderTypes.setRenderLayer(ModBlocks.COAL_BLOCK_1X.get(), renderType -> renderType == RenderType.solid() || renderType == RenderType.translucent()); { "parent": "block/block", "loader": "forge:multi-layer", "layers": { "solid": { "parent": "block/cube_all", "textures": { "all": "minecraft:block/coal_block" }, "transform": { "origin": "center", "scale": 1 } }, "translucent": { "parent": "block/cube_all", "textures": { "all": "maybecompressed:block/1x" } } }, "textures": { "particle": "minecraft:block/coal_block" } } Which is based on the source of AllTheCompressed mod. I also tried: { "parent": "minecraft:block/cube_all", "textures": { "layer0": "minecraft:block/coal_block" "layer1": "maybecompressed:block/1x" } } I see that on the Forge docs ItemBlockRenderTypes#setRenderLayer() is depricated, but I am unsure of how to get around that.
  5. I am now using the following code. Maybe I'm slow or something, but the effect still doesn't work, I even tried it with Mikul's solution. public void onArmorTick(Player player, ItemStack stack) { if (player.getItemBySlot(EquipmentSlot.CHEST).getItem() == stack.getItem() && player.isCrouching()) { player.addEffect(new MobEffectInstance(MobEffects.INVISIBILITY, 20, 0, true, false)); player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 20, 1, true, false)); } }
  6. I wanna say you would use something along the lines of: @SubscribeEvent public void onJoin(EntityJoinWorldEvent event) { if (event.getEntity() instanceof Player && !event.getWorld().isClient()) { Player player = (Player) event.getEntity(); player.getInventory().add(new ItemStack(Items.CARROT)); player.sendMessage(Component.nullToEmpty("Hello!")); } } I may be wrong though.
  7. Hello, So far I was able to add an armor item, but I cant find a way to check if the player is crouched while wearing the "chestplate" and if they are crouched, apply an effect while crouching. Would it cause lag if it were to check every tick? Is there a better way around this? Is it not possible? Here is my code: public static final RegistryObject<ArmorItem> CLOAK_OF_SHADOWS = ITEMS.register("cloak_of_shadows", () -> new ArmorItem(ArmorMaterials.LEATHER, ArmorItem.Type.CHESTPLATE, new Item.Properties() { public void onArmorTick(Player player, ItemStack stack) { if (player.getItemBySlot(EquipmentSlot.CHEST) == stack) { if (player.isCrouching()) { // Check if player is crouching player.addEffect(new MobEffectInstance(MobEffects.INVISIBILITY, 20, 0, true, false)); player.addEffect(new MobEffectInstance(MobEffects.MOVEMENT_SPEED, 20, 1, true, false)); } } } }));
  8. https://nekoyue.github.io/ForgeJavaDocs-NG/javadoc/1.16.5/net/minecraft/entity/LivingEntity.html#startUsingItem-net.minecraft.util.Hand- (startUsingItem) These might help
  9. Are you trying to have the values changed on startup or when the game/server is already started? Couldn't you just change the values and then restart the game/server to have them updated?
  10. https://minecraft.fandom.com/wiki/Tutorials/Command_NBT_tags This was pretty helpful when I was trying to figure out how NBT data works
  11. There is no api to put into the mods folder. If you host the server yourself, you use the installer to download the server files, if you use a dedicated host, select your forge version through the hosting provider.
  12. https://files.minecraftforge.net/net/minecraftforge/forge/ There is an option to download a server or a client when you run the installer If you're looking for documentation: https://docs.minecraftforge.net/en/latest/
  13. So after a bunch of searching the error only happens when I change the modId="examplemod" to my own modid in the mods.toml file. I used a different modid and it worked, but it could just be that I am dumb as hell and cant solve a simple problem
  14. This may sound like the weirded shit ever, but I refollowed the Getting Started section and it was all going well until I edited the mods.toml file. The only thing I changed in there was the name and author. If I don't touch the file, no error occurs and I can start the client like normal (gives an error, but the game actually starts).
  15. I see that my minecraft launcher is installing it's installations to the curseforge client install location, but after running the runClient, it gives the error but neither the log for the vanilla launcher, nor the curseforge launcher change.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.