Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

DevTech

Members
  • Joined

  • Last visited

Everything posted by DevTech

  1. its dosnt exist.. (in 1.15.2)
  2. i want to render a head but i must have this method
  3. can you send me an example how i can draw something in it?
  4. I can Java ^^ And i have already published some mods
  5. and how can i create one
  6. like so (the black should then be replaced with the head)
  7. @Override public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { target.addPotionEffect(new EffectInstance(Effects.WEAKNESS, 200, 0)); return super.hitEntity(stack, target, attacker); }
  8. I would like to create one. If you have it in your hand like a map you should hold it in your hand and then the player should be head.
  9. How to add Advancements in Forge 1.15.2
  10. How can i scale Projectile Entities that are rendered with SpriteRender
  11. I have fixxed it /thread
  12. Hey need help i changed the methodes in my Main Class package de.krokoyt.element; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.data.LootTableProvider; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.IProjectile; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.storage.loot.ItemLootEntry; import net.minecraft.world.storage.loot.LootFunction; import net.minecraft.world.storage.loot.LootPool; import net.minecraft.world.storage.loot.LootTable; import net.minecraft.world.storage.loot.LootTables; import net.minecraft.world.storage.loot.TableLootEntry; import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; 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.IForgeRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import de.krokoyt.element.entity.EntityTypes; import de.krokoyt.element.entity.Heal; import de.krokoyt.element.entity.Vampire; import de.krokoyt.element.entity.Wind; import de.krokoyt.element.entity.Bubble; import de.krokoyt.element.items.ElectricStaff; import de.krokoyt.element.items.FireStaff; import de.krokoyt.element.items.HealthStaff; import de.krokoyt.element.items.Healthball; import de.krokoyt.element.items.IceStaff; import de.krokoyt.element.items.ItemBase; import de.krokoyt.element.items.Vamireball; import de.krokoyt.element.items.WaterStaff; import de.krokoyt.element.items.Waterball; import de.krokoyt.element.items.WindStaff; import java.util.stream.Collectors; import javax.annotation.Nonnull; // The value here should match an entry in the META-INF/mods.toml file @Mod("element") public class Element { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); private final CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); public Element() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::clientSetup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new EntityTypes()); MinecraftForge.EVENT_BUS.register(new Events()); } @OnlyIn(Dist.CLIENT) private void clientSetup(FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(RegistryEvents.vampireentity, manager -> new SpriteRenderer(manager, Minecraft.getInstance().getItemRenderer())); RenderingRegistry.registerEntityRenderingHandler(RegistryEvents.healentity, manager -> new SpriteRenderer(manager, Minecraft.getInstance().getItemRenderer())); RenderingRegistry.registerEntityRenderingHandler(RegistryEvents.waterentity, manager -> new SpriteRenderer(manager, Minecraft.getInstance().getItemRenderer())); RenderingRegistry.registerEntityRenderingHandler(RegistryEvents.windentity, manager -> new SpriteRenderer(manager, Minecraft.getInstance().getItemRenderer())); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client // RenderingRegistry.registerEntityRenderingHandler(Vampire.class, render -> new SpriteRenderer(render, Minecraft.getInstance().getItemRenderer())); LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { public static ItemGroup tab = new CreativeTab(); public static Item DarkStaff = new de.krokoyt.element.items.DarkStaff(); public static Item ElectricStaff = new ElectricStaff(); public static Item FireStaff = new FireStaff(); public static Item HealStaff = new HealthStaff(); public static Item WaterStaff = new WaterStaff(); public static Item PoisonStaff = new de.krokoyt.element.items.PoisonStaff(); public static Item WindStaff = new WindStaff(); public static Item IceStaff = new IceStaff(); public static final Item staff = new ItemBase("staff", 64, tab); public static final Item magicessense = new ItemBase("magicessence", 64, tab); public static final Item dark = new ItemBase("darkessense", 64, tab); public static final Item electrik = new ItemBase("electrikessense", 64, tab); public static final Item fire = new ItemBase("fireessense", 64, tab); public static final Item ice = new ItemBase("iceessense", 64, tab); public static final Item life = new ItemBase("lifeessense", 64, tab); public static final Item poison = new ItemBase("poisonessense", 64, tab); public static final Item water = new ItemBase("wateressense", 64, tab); public static final Item wind = new ItemBase("windessense", 64, tab); public static final Item vampireball = new Vamireball(); public static final Item healthball = new Healthball(); public static final Item waterball = new Waterball(); public static final SoundEvent MAGIC = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "magic"))).setRegistryName("magic"); public static final SoundEvent WIND = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "wind"))).setRegistryName("wind"); @SubscribeEvent public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) { event.getRegistry().register(MAGIC); event.getRegistry().register(WIND); } public static final EntityType<Vampire> vampireentity = EntityType.Builder.<Vampire>create(Vampire::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Vampire::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:vampire"); public static final EntityType<Heal> healentity = EntityType.Builder.<Heal>create(Heal::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Heal::new).setUpdateInterval(1).setTrackingRange(128).size(0.6F, 0.6F).build("element:heal"); public static final EntityType<Bubble> waterentity = EntityType.Builder.<Bubble>create(Bubble::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Bubble::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:bubble"); public static final EntityType<Wind> windentity = EntityType.Builder.<Wind>create(Wind::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Wind::new).setUpdateInterval(1).setTrackingRange(128).size(6F, 6F).build("element:wind"); @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().register(vampireentity.setRegistryName(new ResourceLocation("element", "vampire"))); event.getRegistry().register(healentity.setRegistryName(new ResourceLocation("element", "heal"))); event.getRegistry().register(waterentity.setRegistryName(new ResourceLocation("element", "bubble"))); event.getRegistry().register(windentity.setRegistryName(new ResourceLocation("element", "wind"))); } @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> e) { e.getRegistry().register(DarkStaff); e.getRegistry().register(ElectricStaff); e.getRegistry().register(FireStaff); e.getRegistry().register(HealStaff); e.getRegistry().register(WaterStaff); e.getRegistry().register(PoisonStaff); e.getRegistry().register(WindStaff); e.getRegistry().register(IceStaff); e.getRegistry().register(staff); e.getRegistry().register(magicessense); e.getRegistry().register(dark); e.getRegistry().register(electrik); e.getRegistry().register(fire); e.getRegistry().register(ice); e.getRegistry().register(life); e.getRegistry().register(poison); e.getRegistry().register(water); e.getRegistry().register(wind); e.getRegistry().register(vampireball); e.getRegistry().register(healthball); e.getRegistry().register(waterball); } } }
  13. The Console say No render registered for the entity but i have already set the render
  14. Now have i another error: java.lang.IllegalStateException: No renderer registered for element:vampire Main: package de.krokoyt.element; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.data.LootTableProvider; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.IProjectile; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.storage.loot.ItemLootEntry; import net.minecraft.world.storage.loot.LootFunction; import net.minecraft.world.storage.loot.LootPool; import net.minecraft.world.storage.loot.LootTable; import net.minecraft.world.storage.loot.LootTables; import net.minecraft.world.storage.loot.TableLootEntry; import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; 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.IForgeRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import de.krokoyt.element.entity.EntityTypes; import de.krokoyt.element.entity.Heal; import de.krokoyt.element.entity.Vampire; import de.krokoyt.element.entity.Wind; import de.krokoyt.element.entity.Bubble; import de.krokoyt.element.items.ElectricStaff; import de.krokoyt.element.items.FireStaff; import de.krokoyt.element.items.HealthStaff; import de.krokoyt.element.items.Healthball; import de.krokoyt.element.items.IceStaff; import de.krokoyt.element.items.ItemBase; import de.krokoyt.element.items.Vamireball; import de.krokoyt.element.items.WaterStaff; import de.krokoyt.element.items.Waterball; import de.krokoyt.element.items.WindStaff; import java.util.stream.Collectors; import javax.annotation.Nonnull; // The value here should match an entry in the META-INF/mods.toml file @Mod("element") public class Element { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); private final CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); public Element() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new EntityTypes()); MinecraftForge.EVENT_BUS.register(new Events()); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client // RenderingRegistry.registerEntityRenderingHandler(Vampire.class, render -> new SpriteRenderer(render, Minecraft.getInstance().getItemRenderer())); LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { public static ItemGroup tab = new CreativeTab(); public static Item DarkStaff = new de.krokoyt.element.items.DarkStaff(); public static Item ElectricStaff = new ElectricStaff(); public static Item FireStaff = new FireStaff(); public static Item HealStaff = new HealthStaff(); public static Item WaterStaff = new WaterStaff(); public static Item PoisonStaff = new de.krokoyt.element.items.PoisonStaff(); public static Item WindStaff = new WindStaff(); public static Item IceStaff = new IceStaff(); public static final Item staff = new ItemBase("staff", 64, tab); public static final Item magicessense = new ItemBase("magicessence", 64, tab); public static final Item dark = new ItemBase("darkessense", 64, tab); public static final Item electrik = new ItemBase("electrikessense", 64, tab); public static final Item fire = new ItemBase("fireessense", 64, tab); public static final Item ice = new ItemBase("iceessense", 64, tab); public static final Item life = new ItemBase("lifeessense", 64, tab); public static final Item poison = new ItemBase("poisonessense", 64, tab); public static final Item water = new ItemBase("wateressense", 64, tab); public static final Item wind = new ItemBase("windessense", 64, tab); public static final Item vampireball = new Vamireball(); public static final Item healthball = new Healthball(); public static final Item waterball = new Waterball(); public static final SoundEvent MAGIC = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "magic"))).setRegistryName("magic"); public static final SoundEvent WIND = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "wind"))).setRegistryName("wind"); @SubscribeEvent public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) { event.getRegistry().register(MAGIC); event.getRegistry().register(WIND); } public static EntityType<Vampire> vampireentity = (EntityType<Vampire>) EntityType.Builder.<Vampire>create(Vampire::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Vampire::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:vampire").setRegistryName("element", "vampire"); public static EntityType<Heal> healentity = (EntityType<Heal>) EntityType.Builder.<Heal>create(Heal::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Heal::new).setUpdateInterval(1).setTrackingRange(128).size(0.6F, 0.6F).build("element:heal").setRegistryName("element", "heal"); public static EntityType<Bubble> waterentity = (EntityType<Bubble>) EntityType.Builder.<Bubble>create(Bubble::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Bubble::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:bubble").setRegistryName("element", "bubble"); public static EntityType<Wind> windentity = (EntityType<Wind>) EntityType.Builder.<Wind>create(Wind::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Wind::new).setUpdateInterval(1).setTrackingRange(128).size(6F, 6F).build("element:wind").setRegistryName("element", "wind"); @SubscribeEvent public static void registerModels(FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(vampireentity, new IRenderFactory<Vampire>() { @Override public EntityRenderer<Vampire> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Vampire>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(healentity, new IRenderFactory<Heal>() { @Override public EntityRenderer<Heal> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Heal>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(waterentity, new IRenderFactory<Bubble>() { @Override public EntityRenderer<Bubble> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Bubble>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(windentity, new IRenderFactory<Wind>() { @Override public EntityRenderer<Wind> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Wind>(manager, Minecraft.getInstance().getItemRenderer()); } }); } @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> e) { IForgeRegistry<EntityType<?>> registry = e.getRegistry(); registry.register(vampireentity); registry.register(healentity); registry.register(waterentity); registry.register(windentity); } @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> e) { e.getRegistry().register(DarkStaff); e.getRegistry().register(ElectricStaff); e.getRegistry().register(FireStaff); e.getRegistry().register(HealStaff); e.getRegistry().register(WaterStaff); e.getRegistry().register(PoisonStaff); e.getRegistry().register(WindStaff); e.getRegistry().register(IceStaff); e.getRegistry().register(staff); e.getRegistry().register(magicessense); e.getRegistry().register(dark); e.getRegistry().register(electrik); e.getRegistry().register(fire); e.getRegistry().register(ice); e.getRegistry().register(life); e.getRegistry().register(poison); e.getRegistry().register(water); e.getRegistry().register(wind); e.getRegistry().register(vampireball); e.getRegistry().register(healthball); e.getRegistry().register(waterball); } } }
  15. here my main class: package de.krokoyt.element; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.data.LootTableProvider; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.IProjectile; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.storage.loot.ItemLootEntry; import net.minecraft.world.storage.loot.LootFunction; import net.minecraft.world.storage.loot.LootPool; import net.minecraft.world.storage.loot.LootTable; import net.minecraft.world.storage.loot.LootTables; import net.minecraft.world.storage.loot.TableLootEntry; import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; 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.IForgeRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import de.krokoyt.element.entity.EntityTypes; import de.krokoyt.element.entity.Heal; import de.krokoyt.element.entity.Vampire; import de.krokoyt.element.entity.Wind; import de.krokoyt.element.entity.Bubble; import de.krokoyt.element.items.ElectricStaff; import de.krokoyt.element.items.FireStaff; import de.krokoyt.element.items.HealthStaff; import de.krokoyt.element.items.Healthball; import de.krokoyt.element.items.IceStaff; import de.krokoyt.element.items.ItemBase; import de.krokoyt.element.items.Vamireball; import de.krokoyt.element.items.WaterStaff; import de.krokoyt.element.items.Waterball; import de.krokoyt.element.items.WindStaff; import java.util.stream.Collectors; import javax.annotation.Nonnull; // The value here should match an entry in the META-INF/mods.toml file @Mod("element") public class Element { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); private final CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); public Element() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new EntityTypes()); MinecraftForge.EVENT_BUS.register(new Events()); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client // RenderingRegistry.registerEntityRenderingHandler(Vampire.class, render -> new SpriteRenderer(render, Minecraft.getInstance().getItemRenderer())); LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { public static ItemGroup tab = new CreativeTab(); public static Item DarkStaff = new de.krokoyt.element.items.DarkStaff(); public static Item ElectricStaff = new ElectricStaff(); public static Item FireStaff = new FireStaff(); public static Item HealStaff = new HealthStaff(); public static Item WaterStaff = new WaterStaff(); public static Item PoisonStaff = new de.krokoyt.element.items.PoisonStaff(); public static Item WindStaff = new WindStaff(); public static Item IceStaff = new IceStaff(); public static final Item staff = new ItemBase("staff", 64, tab); public static final Item magicessense = new ItemBase("magicessence", 64, tab); public static final Item dark = new ItemBase("darkessense", 64, tab); public static final Item electrik = new ItemBase("electrikessense", 64, tab); public static final Item fire = new ItemBase("fireessense", 64, tab); public static final Item ice = new ItemBase("iceessense", 64, tab); public static final Item life = new ItemBase("lifeessense", 64, tab); public static final Item poison = new ItemBase("poisonessense", 64, tab); public static final Item water = new ItemBase("wateressense", 64, tab); public static final Item wind = new ItemBase("windessense", 64, tab); public static final Item vampireball = new Vamireball(); public static final Item healthball = new Healthball(); public static final Item waterball = new Waterball(); public static final SoundEvent MAGIC = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "magic"))).setRegistryName("magic"); public static final SoundEvent WIND = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "wind"))).setRegistryName("wind"); @SubscribeEvent public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) { event.getRegistry().register(MAGIC); event.getRegistry().register(WIND); } public static EntityType<Vampire> vampireentity = (EntityType<Vampire>) EntityType.Builder.<Vampire>create(Vampire::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Vampire::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:vampire").setRegistryName("element", "vampire"); public static EntityType<Heal> healentity = (EntityType<Heal>) EntityType.Builder.<Heal>create(Heal::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Heal::new).setUpdateInterval(1).setTrackingRange(128).size(0.6F, 0.6F).build("element:heal").setRegistryName("element", "heal"); public static EntityType<Bubble> waterentity = (EntityType<Bubble>) EntityType.Builder.<Bubble>create(Bubble::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Bubble::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:bubble").setRegistryName("element", "bubble"); public static EntityType<Wind> windentity = (EntityType<Wind>) EntityType.Builder.<Wind>create(Wind::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Wind::new).setUpdateInterval(1).setTrackingRange(128).size(6F, 6F).build("element:wind").setRegistryName("element", "wind"); @SubscribeEvent public static void registerModels(FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(vampireentity, new IRenderFactory<Vampire>() { @Override public EntityRenderer<Vampire> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Vampire>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(healentity, new IRenderFactory<Heal>() { @Override public EntityRenderer<Heal> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Heal>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(waterentity, new IRenderFactory<Bubble>() { @Override public EntityRenderer<Bubble> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Bubble>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(windentity, new IRenderFactory<Wind>() { @Override public EntityRenderer<Wind> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Wind>(manager, Minecraft.getInstance().getItemRenderer()); } }); } @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> e) { IForgeRegistry<EntityType<?>> registry = e.getRegistry(); healentity.setRegistryName("element", "heal"); vampireentity.setRegistryName("element", "vampire"); waterentity.setRegistryName("element", "bubble"); windentity.setRegistryName("element", "wind"); registry.register(vampireentity); registry.register(healentity); registry.register(waterentity); registry.register(windentity); } @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> e) { e.getRegistry().register(DarkStaff); e.getRegistry().register(ElectricStaff); e.getRegistry().register(FireStaff); e.getRegistry().register(HealStaff); e.getRegistry().register(WaterStaff); e.getRegistry().register(PoisonStaff); e.getRegistry().register(WindStaff); e.getRegistry().register(IceStaff); e.getRegistry().register(staff); e.getRegistry().register(magicessense); e.getRegistry().register(dark); e.getRegistry().register(electrik); e.getRegistry().register(fire); e.getRegistry().register(ice); e.getRegistry().register(life); e.getRegistry().register(poison); e.getRegistry().register(water); e.getRegistry().register(wind); e.getRegistry().register(vampireball); e.getRegistry().register(healthball); e.getRegistry().register(waterball); } } }
  16. new error: "java.lang.IllegalStateException: Attempted to set registry name with existing registry name! New: element:heal Old: element:heal"
  17. the game crashes and say "java.lang.IllegalStateException: No renderer registered for element:vampire" package de.krokoyt.element; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.data.LootTableProvider; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.IProjectile; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.storage.loot.ItemLootEntry; import net.minecraft.world.storage.loot.LootFunction; import net.minecraft.world.storage.loot.LootPool; import net.minecraft.world.storage.loot.LootTable; import net.minecraft.world.storage.loot.LootTables; import net.minecraft.world.storage.loot.TableLootEntry; import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; 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.IForgeRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import de.krokoyt.element.entity.EntityTypes; import de.krokoyt.element.entity.Heal; import de.krokoyt.element.entity.Vampire; import de.krokoyt.element.entity.Wind; import de.krokoyt.element.entity.Bubble; import de.krokoyt.element.items.ElectricStaff; import de.krokoyt.element.items.FireStaff; import de.krokoyt.element.items.HealthStaff; import de.krokoyt.element.items.Healthball; import de.krokoyt.element.items.IceStaff; import de.krokoyt.element.items.ItemBase; import de.krokoyt.element.items.Vamireball; import de.krokoyt.element.items.WaterStaff; import de.krokoyt.element.items.Waterball; import de.krokoyt.element.items.WindStaff; import java.util.stream.Collectors; import javax.annotation.Nonnull; // The value here should match an entry in the META-INF/mods.toml file @Mod("element") public class Element { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); private final CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); public Element() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new EntityTypes()); MinecraftForge.EVENT_BUS.register(new Events()); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client // RenderingRegistry.registerEntityRenderingHandler(Vampire.class, render -> new SpriteRenderer(render, Minecraft.getInstance().getItemRenderer())); LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { public static ItemGroup tab = new CreativeTab(); public static Item DarkStaff = new de.krokoyt.element.items.DarkStaff(); public static Item ElectricStaff = new ElectricStaff(); public static Item FireStaff = new FireStaff(); public static Item HealStaff = new HealthStaff(); public static Item WaterStaff = new WaterStaff(); public static Item PoisonStaff = new de.krokoyt.element.items.PoisonStaff(); public static Item WindStaff = new WindStaff(); public static Item IceStaff = new IceStaff(); public static final Item staff = new ItemBase("staff", 64, tab); public static final Item magicessense = new ItemBase("magicessence", 64, tab); public static final Item dark = new ItemBase("darkessense", 64, tab); public static final Item electrik = new ItemBase("electrikessense", 64, tab); public static final Item fire = new ItemBase("fireessense", 64, tab); public static final Item ice = new ItemBase("iceessense", 64, tab); public static final Item life = new ItemBase("lifeessense", 64, tab); public static final Item poison = new ItemBase("poisonessense", 64, tab); public static final Item water = new ItemBase("wateressense", 64, tab); public static final Item wind = new ItemBase("windessense", 64, tab); public static final Item vampireball = new Vamireball(); public static final Item healthball = new Healthball(); public static final Item waterball = new Waterball(); public static final SoundEvent MAGIC = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "magic"))).setRegistryName("magic"); public static final SoundEvent WIND = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "wind"))).setRegistryName("wind"); @SubscribeEvent public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) { event.getRegistry().register(MAGIC); event.getRegistry().register(WIND); } public static EntityType<Vampire> vampireentity = EntityType.Builder.<Vampire>create(Vampire::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Vampire::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:vampire"); public static EntityType<Heal> healentity = EntityType.Builder.<Heal>create(Heal::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Heal::new).setUpdateInterval(1).setTrackingRange(128).size(0.6F, 0.6F).build("element:heal"); public static EntityType<Bubble> waterentity = EntityType.Builder.<Bubble>create(Bubble::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Bubble::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:bubble"); public static EntityType<Wind> windentity = EntityType.Builder.<Wind>create(Wind::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Wind::new).setUpdateInterval(1).setTrackingRange(128).size(6F, 6F).build("element:wind"); @SubscribeEvent public static void registerModels(FMLClientSetupEvent event) { vampireentity.setRegistryName("element", "vampire"); healentity.setRegistryName("element", "heal"); waterentity.setRegistryName("element", "bubble"); windentity.setRegistryName("element", "wind"); RenderingRegistry.registerEntityRenderingHandler(vampireentity, new IRenderFactory<Vampire>() { @Override public EntityRenderer<Vampire> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Vampire>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(healentity, new IRenderFactory<Heal>() { @Override public EntityRenderer<Heal> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Heal>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(waterentity, new IRenderFactory<Bubble>() { @Override public EntityRenderer<Bubble> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Bubble>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(windentity, new IRenderFactory<Wind>() { @Override public EntityRenderer<Wind> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Wind>(manager, Minecraft.getInstance().getItemRenderer()); } }); } @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> e) { IForgeRegistry<EntityType<?>> registry = e.getRegistry(); healentity.setRegistryName("element", "heal"); vampireentity.setRegistryName("element", "vampire"); waterentity.setRegistryName("element", "bubble"); windentity.setRegistryName("element", "wind"); registry.register(vampireentity); registry.register(healentity); registry.register(waterentity); registry.register(windentity); } @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> e) { e.getRegistry().register(DarkStaff); e.getRegistry().register(ElectricStaff); e.getRegistry().register(FireStaff); e.getRegistry().register(HealStaff); e.getRegistry().register(WaterStaff); e.getRegistry().register(PoisonStaff); e.getRegistry().register(WindStaff); e.getRegistry().register(IceStaff); e.getRegistry().register(staff); e.getRegistry().register(magicessense); e.getRegistry().register(dark); e.getRegistry().register(electrik); e.getRegistry().register(fire); e.getRegistry().register(ice); e.getRegistry().register(life); e.getRegistry().register(poison); e.getRegistry().register(water); e.getRegistry().register(wind); e.getRegistry().register(vampireball); e.getRegistry().register(healthball); e.getRegistry().register(waterball); } } }
  18. how can i set the registry name? this mod has worked in 1.14.4 but in 1.15.1 not
  19. i have it already done but the game says always when i start: "java.lang.IllegalStateException: No renderer registered for element:vampire" Main: package de.krokoyt.element; import net.minecraft.block.Block; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.SpriteRenderer; import net.minecraft.data.LootTableProvider; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntitySpawnPlacementRegistry; import net.minecraft.entity.EntityType; import net.minecraft.entity.IProjectile; import net.minecraft.item.Item; import net.minecraft.item.ItemGroup; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.storage.loot.ItemLootEntry; import net.minecraft.world.storage.loot.LootFunction; import net.minecraft.world.storage.loot.LootPool; import net.minecraft.world.storage.loot.LootTable; import net.minecraft.world.storage.loot.LootTables; import net.minecraft.world.storage.loot.TableLootEntry; import net.minecraft.world.storage.loot.conditions.ILootCondition; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.LootTableLoadEvent; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.InterModComms; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.client.registry.RenderingRegistry; 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.IForgeRegistry; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import de.krokoyt.element.entity.EntityTypes; import de.krokoyt.element.entity.Heal; import de.krokoyt.element.entity.Vampire; import de.krokoyt.element.entity.Wind; import de.krokoyt.element.entity.Bubble; import de.krokoyt.element.items.ElectricStaff; import de.krokoyt.element.items.FireStaff; import de.krokoyt.element.items.HealthStaff; import de.krokoyt.element.items.Healthball; import de.krokoyt.element.items.IceStaff; import de.krokoyt.element.items.ItemBase; import de.krokoyt.element.items.Vamireball; import de.krokoyt.element.items.WaterStaff; import de.krokoyt.element.items.Waterball; import de.krokoyt.element.items.WindStaff; import java.util.stream.Collectors; import javax.annotation.Nonnull; // The value here should match an entry in the META-INF/mods.toml file @Mod("element") public class Element { // Directly reference a log4j logger. private static final Logger LOGGER = LogManager.getLogger(); private final CommonProxy proxy = DistExecutor.runForDist(() -> ClientProxy::new, () -> CommonProxy::new); public Element() { // Register the setup method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); // Register the enqueueIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::enqueueIMC); // Register the processIMC method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::processIMC); // Register the doClientStuff method for modloading FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); // Register ourselves for server and other game events we are interested in MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(new EntityTypes()); MinecraftForge.EVENT_BUS.register(new Events()); } private void setup(final FMLCommonSetupEvent event) { // some preinit code LOGGER.info("HELLO FROM PREINIT"); LOGGER.info("DIRT BLOCK >> {}", Blocks.DIRT.getRegistryName()); } private void doClientStuff(final FMLClientSetupEvent event) { // do something that can only be done on the client // RenderingRegistry.registerEntityRenderingHandler(Vampire.class, render -> new SpriteRenderer(render, Minecraft.getInstance().getItemRenderer())); LOGGER.info("Got game settings {}", event.getMinecraftSupplier().get().gameSettings); } private void enqueueIMC(final InterModEnqueueEvent event) { // some example code to dispatch IMC to another mod InterModComms.sendTo("examplemod", "helloworld", () -> { LOGGER.info("Hello world from the MDK"); return "Hello world";}); } private void processIMC(final InterModProcessEvent event) { // some example code to receive and process InterModComms from other mods LOGGER.info("Got IMC {}", event.getIMCStream(). map(m->m.getMessageSupplier().get()). collect(Collectors.toList())); } // You can use SubscribeEvent and let the Event Bus discover methods to call @SubscribeEvent public void onServerStarting(FMLServerStartingEvent event) { // do something when the server starts LOGGER.info("HELLO from server starting"); } // You can use EventBusSubscriber to automatically subscribe events on the contained class (this is subscribing to the MOD // Event bus for receiving Registry Events) @Mod.EventBusSubscriber(bus=Mod.EventBusSubscriber.Bus.MOD) public static class RegistryEvents { public static ItemGroup tab = new CreativeTab(); public static Item DarkStaff = new de.krokoyt.element.items.DarkStaff(); public static Item ElectricStaff = new ElectricStaff(); public static Item FireStaff = new FireStaff(); public static Item HealStaff = new HealthStaff(); public static Item WaterStaff = new WaterStaff(); public static Item PoisonStaff = new de.krokoyt.element.items.PoisonStaff(); public static Item WindStaff = new WindStaff(); public static Item IceStaff = new IceStaff(); public static final Item staff = new ItemBase("staff", 64, tab); public static final Item magicessense = new ItemBase("magicessence", 64, tab); public static final Item dark = new ItemBase("darkessense", 64, tab); public static final Item electrik = new ItemBase("electrikessense", 64, tab); public static final Item fire = new ItemBase("fireessense", 64, tab); public static final Item ice = new ItemBase("iceessense", 64, tab); public static final Item life = new ItemBase("lifeessense", 64, tab); public static final Item poison = new ItemBase("poisonessense", 64, tab); public static final Item water = new ItemBase("wateressense", 64, tab); public static final Item wind = new ItemBase("windessense", 64, tab); public static final Item vampireball = new Vamireball(); public static final Item healthball = new Healthball(); public static final Item waterball = new Waterball(); public static final SoundEvent MAGIC = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "magic"))).setRegistryName("magic"); public static final SoundEvent WIND = (SoundEvent)(new SoundEvent(new ResourceLocation("element", "wind"))).setRegistryName("wind"); @SubscribeEvent public static void registerSoundEvents(RegistryEvent.Register<SoundEvent> event) { event.getRegistry().register(MAGIC); event.getRegistry().register(WIND); } public static EntityType<Vampire> vampireentity = EntityType.Builder.<Vampire>create(Vampire::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Vampire::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:vampire"); public static EntityType<Heal> healentity = EntityType.Builder.<Heal>create(Heal::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Heal::new).setUpdateInterval(1).setTrackingRange(128).size(0.6F, 0.6F).build("element:heal"); public static EntityType<Bubble> waterentity = EntityType.Builder.<Bubble>create(Bubble::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Bubble::new).setUpdateInterval(1).setTrackingRange(128).size(1F, 1F).build("element:bubble"); public static EntityType<Wind> windentity = EntityType.Builder.<Wind>create(Wind::new, EntityClassification.MISC).setShouldReceiveVelocityUpdates(true).setCustomClientFactory(Wind::new).setUpdateInterval(1).setTrackingRange(128).size(6F, 6F).build("element:wind"); @SubscribeEvent public static void registerModels(FMLClientSetupEvent event) { RenderingRegistry.registerEntityRenderingHandler(vampireentity, new IRenderFactory<Vampire>() { @Override public EntityRenderer<Vampire> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Vampire>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(healentity, new IRenderFactory<Heal>() { @Override public EntityRenderer<Heal> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Heal>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(waterentity, new IRenderFactory<Bubble>() { @Override public EntityRenderer<Bubble> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Bubble>(manager, Minecraft.getInstance().getItemRenderer()); } }); RenderingRegistry.registerEntityRenderingHandler(windentity, new IRenderFactory<Wind>() { @Override public EntityRenderer<Wind> createRenderFor(EntityRendererManager manager) { return new SpriteRenderer<Wind>(manager, Minecraft.getInstance().getItemRenderer()); } }); } @SubscribeEvent public static void registerEntity(RegistryEvent.Register<EntityType<?>> e) { IForgeRegistry<EntityType<?>> registry = e.getRegistry(); healentity.setRegistryName("element", "heal"); vampireentity.setRegistryName("element", "vampire"); waterentity.setRegistryName("element", "bubble"); windentity.setRegistryName("element", "wind"); registry.register(vampireentity); registry.register(healentity); registry.register(waterentity); registry.register(windentity); } @SubscribeEvent public static void onBlocksRegistry(final RegistryEvent.Register<Block> blockRegistryEvent) { // register a new block here LOGGER.info("HELLO from Register Block"); } @SubscribeEvent public static void onItemRegistry(final RegistryEvent.Register<Item> e) { e.getRegistry().register(DarkStaff); e.getRegistry().register(ElectricStaff); e.getRegistry().register(FireStaff); e.getRegistry().register(HealStaff); e.getRegistry().register(WaterStaff); e.getRegistry().register(PoisonStaff); e.getRegistry().register(WindStaff); e.getRegistry().register(IceStaff); e.getRegistry().register(staff); e.getRegistry().register(magicessense); e.getRegistry().register(dark); e.getRegistry().register(electrik); e.getRegistry().register(fire); e.getRegistry().register(ice); e.getRegistry().register(life); e.getRegistry().register(poison); e.getRegistry().register(water); e.getRegistry().register(wind); e.getRegistry().register(vampireball); e.getRegistry().register(healthball); e.getRegistry().register(waterball); } } }
  20. How to register Entities in Forge 1.15.1 all methodes from 1.14.4 dosnt work anymore
  21. How can i become a deobf file from my api in 1.15.1

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.