Jump to content

Jarkon

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Jarkon

  1. I'd also like to mention that if I use an existing mob in the EventType.Builder.of function, it works fine (I.E. EventType.Builder.of(SlimeEntity::new, EntityClassification.CREATURE) throws no errors)
  2. Here are the relevant classes. First, the main SlimePetMod class: package com.jarkon.slimepetmod; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes; import net.minecraft.entity.monster.SlimeEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.item.SimpleFoiledItem; import net.minecraft.item.SpawnEggItem; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DeferredWorkQueue; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.event.lifecycle.InterModEnqueueEvent; import net.minecraftforge.fml.event.lifecycle.InterModProcessEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; 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; import com.jarkon.slimepetmod.entity.SlimePetEntity; import java.util.stream.Collectors; // The value here should match an entry in the META-INF/mods.toml file @Mod("slimepetmod") public class SlimePetMod { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "slimepetmod"; public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MOD_ID); public static EntityType<?> SLIME_PET_ENTITY = EntityType.Builder.of(SlimePetEntity::new, EntityClassification.CREATURE).build(MOD_ID+":slime_pet").setRegistryName("slime_pet"); public static Item slime_pet_egg; public SlimePetMod() { MinecraftForge.EVENT_BUS.register(this); } public static Item registerEntitySpawnEgg(EntityType<?> type, int color1, int color2, String name) { SpawnEggItem newEgg = new SpawnEggItem(type, color1, color2, new Item.Properties().tab(ItemGroup.TAB_MISC)); newEgg.setRegistryName(name); return newEgg; } @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { @SubscribeEvent public static void registerItems(final RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( slime_pet_egg = registerEntitySpawnEgg(SLIME_PET_ENTITY, 0x008000, 0x008000, "meh") ); } } } Second, the SlimePetEntity class: package com.jarkon.slimepetmod.entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.monster.SlimeEntity; import net.minecraft.world.World; public class SlimePetEntity extends SlimeEntity{ protected SlimePetEntity(EntityType<? extends SlimePetEntity> p_i48574_1_, World p_i48574_2_) { super(p_i48574_1_, p_i48574_2_); } }
  3. Hello, I've recently started working on a new mod that involves something I've never worked on before: creating a custom mob. I've been trying to follow tutorial videos and docs for going about it, but so far most of them seem to ask me to start by creating a basic version of the mobs class, and registering it. However, whenever I try to do so I reach a point where the current version that I'm using seems to conflict with the ones in the tutorials. The tutorials recommend I do something like this: public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, MOD_ID); public static EntityType<?> SLIME_PET_ENTITY = EntityType.Builder.create(SlimePetEntity::new, EntityClassification.CREATURE).build(MOD_ID+":slime_pet").setRegistryName("slime_pet") However, when I try to use Event.Builder.create, the function is unavailable. The only other one I could think to use is EventType.Builder.of(), but I'm having trouble understanding why this one doesn't work and just throws these errors: Is there something I'm missing in the process? Should I be using different functions/ approaches to this registration step, or just skip it entirely? I'll post the relevant classes in a follow-up comment, but I'm currently using the latest recommended version of Forge(36.1.0) and can't seem to understand what I'm doing wrong in this early step of the process. Any help would be greatly appreciated. Thanks in advance!
  4. Perfect, this is just the kind of thing I've been looking for!
  5. I've been trying to set it up in the build.gradle file but it doesn't seem to be loading the mods with what I've done (the game opens now, but it still says that 3 mods are loaded and no Quark or AutoRegLib content seems present). I've added a libs folder to my project and put the jars in it, then added the following to my build.gradle file: I've been seeing conflicting approaches to adding the files online. Is there a different way I should add these dependencies?
  6. As the title says, I've started a completely clean mod in the latest version of Forge for 1.16.5 in Eclipse. For the most part it runs like normal (since I haven't touched any of the mod files), but whenever I try to drop add different mod to the runs/mods folder (in this case AutoRegLib, since I would like to make a mod that builds on Quark features), the game can no longer open. It will go through the loading screen and then it will only load the crash screen. I've attached the crash log below, but I want to stress that this only happens when I add the mod to the mods folder, and when I remove it the game opens again fine. If there's a step to getting other mods to run in eclipse that I'm missing I would really appreciate if someone could let me know. Thanks in advance for any help!! crash-2021-06-01_13.26.38-fml.txt
  7. Found a solution! To anyone who may wonder in the future, I ended up using the readAdditionalSaveData function of the HorseEntity class, and passed in a compoundNBT tag with the Variant value already calculated. In the future if anyone has any other questions on this topic, go ahead and post them here!
  8. Hello everyone! New to the modding community and the forums, but I'll go ahead and get right to it: I'm trying to make a mod that allows me to spawn a horse with specific variants set (i.e. the coat color and coat type). I've been combing through the horse code for a while, and it seems like anything that would allow be to do this has been blocked off. The main function I'd want to use, setVariantAndMarkings() in the HorseEntity class, is private. I've tried replicating what the function itself does, but it relies on more private information (it has to set the entitydata using a unique id defined privately at the top of the class: DATA_ID_TYPE_VARIANT). Does anyone know of any way I could get around these roadblocks? I've been trying out various approaches for hours now to no avail. If any more info is needed feel free to ask and I'll happily provide some. Any help would be greatly appreciated! Thanks!
×
×
  • Create New...

Important Information

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