Jump to content

Skullblade

Members
  • Posts

    102
  • Joined

  • Last visited

Everything posted by Skullblade

  1. The mob I want to create, known as "Bloodghast" (unrelated to a Nether Ghast), is a Vampire Spirit, or in other words, undead. (Burns in daylight, etc) It is hostile to the player, hovers above ground but doesn't actually fly like a Ghast or a Phantom. I would also like it to be able to pass through walls 1 block thick if possible and track players through those walls, but that might be a topic for another thread. Here is what I have so far: I included the Blockbench texture and model here to prove that, A: I have both (.png and .java), and B: So you can have an idea what I'm going for. The Bloodghast should be around player's height. In fact, it should be very similar to a Blaze, minus the fireballs and flying part. Any and all help is appreciated.
  2. If you have a tutorial you can give me, I'd appreciate it. I've been searching for 3 hours and I can't find one. All I have is a Blockbench 3d model, a texture, and some snippets of Zombie code in a .json file. I don't know how to connect the two together, or what Java Classes I would need to make.
  3. I can't seem to find either. Where would I find Linkie or the Forge Discord server?
  4. I've been getting into Minecraft modding recently for 1.16, and I've found that many (if not all) of the lists of methods on the internet are now outdated. For example, setFire is now setSecondsOnFire. Is there either a website I can go to to find the new method names, or can someone just list them all off? (the latter doesn't seem practical, but I'd rather not make a new post every time I want to use a method) Thanks.
  5. You absolute genius. I had been testing in creative, so there was no way for me to get set on fire to know that. Thank you so much for all of the help. You too eggpasta.
  6. Ok, here it is. Keep in mind that I renamed FlamingSword.java to Embercleave.java for 1, troubleshooting, and 2, I don't intend to reuse the exact code for any other item, so I gave it its final name and I'll just take pieces of it I need for other items later.
  7. I created a new world, spawned a Vindicator, and hit it with Embercleave. It took the right amount of damage, but it wasn't set on fire. Also, I checked the logs and there was nothing.
  8. Nice! (I didn't really know how Lambda worked before, so that was really helpful.) Well, I tested it, as all the errors were fixed (i figured out the last few on their own, they were either in the wrong place or were no longer necessary). I ran the client, and Embercleave didn't set anything on fire...
  9. Oh, that makes sense. The only remaining problems (we're almost done, thank you so much for your help) is "event" in event.getEntity().setSecondsOnFire(10); remaining unresolved and two brackets at the bottom, the higher one saying ')' expected (perhaps the one I just deleted) and the lower one before the final bracket for class FlamingSword saying ';" expected.
  10. Oh, that makes sense. The only remaining problems (we're almost done, thank you so much for your help) is "event" in event.getEntity().setSecondsOnFire(10); remaining unresolved and two brackets at the bottom, the higher one saying ')' expected (perhaps the one I just deleted) and the lower one before the final bracket for class FlamingSword saying ';" expected.
  11. Well, I got rid of () ->, but I have no typos. I've typed it correctly, but I still have this:
  12. Ok, that got rid of some errors. super is fine now, along with some clearer labels. public class FlamingSword now extends SwordItem (I forgot to do that part, sorry eggpasta). I'm still having an issue with p_220045_0_. It says it can't resolve it. Also, I'm not exactly sure where to put my code, and what changes to make. (I'm more of a visual learner, so an example like the last one would be sweet.) Lastly, ItemInit is saying the following about "() -> FlamingSword::new);" Required type: RegistryObject <SwordItem> Provided: RegistryObject <I> I is not a functional interface
  13. Ok, so I did that, but FlamingSword.java is throwing 10 different errors. Here's the code now. ItemInit and FlamingSword are having a related issue, super(ModItemTier.EMBERCLEAVE is saying "Object()' in 'java.lang.Object' cannot be applied to '(com.skullblade.planeswalkermod.ModItemTier, int, float, net.minecraft.item.Item.Properties)", the code doesn't like p_220045_0_, and I'm not sure I implemented the setFire code right. ItemInit.java (just the errored code): private static SwordItem FlamingSword; public static final RegistryObject<SwordItem> EMBERCLEAVE = ITEMS.register("embercleave", () -> FlamingSword: :new); FlamingSword.java (again, just the errored code): public class FlamingSword { public FlamingSword() { super(ModItemTier.EMBERCLEAVE, 5, -2.8f, new Item.Properties().tab(ItemGroup.TAB_COMBAT)); // TODO Auto-generated constructor stub } @Override public boolean hurtEnemy(ItemStack p_77644_1_, LivingEntity p_77644_2_, LivingEntity p_77644_3_) { p_77644_1_.hurtAndBreak(1, p_77644_3_, (p_220045_0_)) -> { p_220045_0_.broadcastBreakEvent(EquipmentSlotType.MAINHAND); p_77644_3_.if (event.getEntity().equals(ItemInit.EMBERCLEAVE.get())) { event.getEntity().setSecondsOnFire(10); } return true; } } }
  14. Okay, so the tutorial I was watching wasn't super clear which one was my item class, so here's the four main ones I have been working with. ItemInit.java: package com.skullblade.planeswalkermod.core.init; import com.skullblade.planeswalkermod.ModItemTier; import com.skullblade.planeswalkermod.PlaneswalkerMod; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.SwordItem; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; public class ItemInit { public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, PlaneswalkerMod.MOD_ID); public static final RegistryObject<SwordItem> EMBERCLEAVE = ITEMS.register("embercleave", () -> new SwordItem(ModItemTier.EMBERCLEAVE, 5, -2.8f, (new Item.Properties()).tab(ItemGroup.TAB_COMBAT))); } PlaneswalkerMod.java: package com.skullblade.planeswalkermod; import com.skullblade.planeswalkermod.core.init.ItemInit; import net.minecraft.item.Item; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.ForgeRegistries; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod("planeswalker") public class PlaneswalkerMod { public static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "planeswalker"; public PlaneswalkerMod() { IEventBus bus = FMLJavaModLoadingContext.get().getModEventBus(); bus.addListener(this::setup); ItemInit.ITEMS.register(bus); MinecraftForge.EVENT_BUS.register(this); } public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, PlaneswalkerMod.MOD_ID); private void setup(final FMLCommonSetupEvent event) { } } EventHandler.java: package com.skullblade.planeswalkermod.core.event; import com.skullblade.planeswalkermod.PlaneswalkerMod; import com.skullblade.planeswalkermod.core.init.ItemInit; import net.minecraftforge.event.entity.player.AttackEntityEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @Mod.EventBusSubscriber(modid = PlaneswalkerMod.MOD_ID, bus = Bus.FORGE) public class EventHandler { @SubscribeEvent public static void setOnFire(final AttackEntityEvent event) { if (event.getEntity().equals(ItemInit.EMBERCLEAVE.get())) { event.getEntity().setSecondsOnFire(10); } } } ModItemTier.java: package com.skullblade.planeswalkermod; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.item.IItemTier; import net.minecraft.item.Items; import net.minecraft.item.crafting.Ingredient; import java.util.function.Supplier; @MethodsReturnNonnullByDefault public enum ModItemTier implements IItemTier { EMBERCLEAVE(1, 1000, 4.0f, 3.0f, 5, () -> Ingredient.of(Items.IRON_INGOT)); private final Supplier<Ingredient> repairmaterial; private final int enchantability; private final float attackDamage; private final float efficiency; private final int maxUses; private final int harvestLevel; ModItemTier(int harvestLevel, int maxUses, float efficiency, float attackDamage, int enchantability, Supplier<Ingredient> repairmaterial) { this.harvestLevel = harvestLevel; this.maxUses = maxUses; this.efficiency = efficiency; this.attackDamage = attackDamage; this.enchantability = enchantability; this.repairmaterial = repairmaterial; } @Override public int getUses() { return 1000; } @Override public float getSpeed() { return 1.2f; } @Override public float getAttackDamageBonus() { return 14; } @Override public int getLevel() { return 1; } @Override public int getEnchantmentValue() { return 5; } @Override public Ingredient getRepairIngredient() { return Ingredient.of(Items.IRON_INGOT); } }
  15. This is getting confusing. What do I put where? If I need to show my classes I can.
  16. I tried MonkeyKnight's suggestion, but I think what PooPooDice said also applies. I can't compare Embercleave to DamageSource. So when I tried it, it didn't work. I'll keep that one in my pocket though, thanks Could I get a more in depth explanation about onLeftClickEntity? Like, what class does it go in? Do I use @Override? Lastly, thank you everyone for helping me this far. It means a lot, as I'm new at this, and I didn't want this to be another of my abandoned projects.
  17. I don't understand where to put or how to use DamageSource. I tried replacing LivingDamageEvent with AttackEntityEvent, but it still gives me the warning about ItemInit.EMBERCLEAVE is inconvertible to Entity.
  18. I took a swing at both solutions, but it wasn't working for me. Could you give me an example of how you would implement those suggestions?
  19. I've been stuck on this for three days now, and I can't find any answer online that makes sense. I'm creating a sword that, among other things, sets mobs and players on fire upon damage. I wrote the following code, and it doesn't seem to apply to the sword. @SubscribeEvent public static void setOnFire(final LivingDamageEvent event) { if (event.getSource().equals(ItemInit.EMBERCLEAVE)) { event.getEntity().setSecondsOnFire(10); } } "EMBERCLEAVE" is what the sword is registered as. I have tried removing the setSecondsOnFire code from the If statement and having it run regardless, and it works (it just means that any source of damage sets things on fire for 10 seconds, including its own fire ticks, leading to infinite seconds on fire). When hovering above equals, my IDE says "'equals' between objects of inconvertible types 'DamageSource' and 'RegistryObject<SwordItem>'." I'm guessing that this is the issue, and the event can't figure out how to convert the values, but I don't know how to fix this issue.
×
×
  • Create New...

Important Information

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