Jump to content

DragonITA

Members
  • Posts

    552
  • Joined

  • Last visited

Everything posted by DragonITA

  1. I think you should update your mod to version 1.15.1, because in the newest versions the most bugs of older versions are solved. If you find the new system too hard to handle, then I recommend that someone explains it to you.
  2. Ok, now it should be solved, try it again and warn me if there is an error (I mean if I imported it wrong) or if there is something else. Thanks for your help. The link was https://github.com/DragonGamerDevelopers/NewFantasyMod-1.15.1.
  3. At first it was meant to register my entities and spawneggs, but then I took a look at your folder to see how you would register your entities, when I saw that you didn't have any entities at all, I looked at the tile entities and tried to imitate it, just for the entities. But since the FantasyModEntities also spawn my entities into the world, I left it there, but any code that has to do with registration, except spawning entities into the world, was converted into a comment.
  4. I had imported it wrong, but you can now read at least my files. It was hard to import it correctly, and i get error logs.
  5. I had imported it wrong, I will now leave it empty, after school I will import it.
  6. Could you show your code?
  7. I think you think the error comes from there, because my entity type doesn't work, and because Spawnegg needs it, the whole Mod crashes.
  8. I think it would be better if you posted your code from github. Let me guess, you followed a tutorial from HarryTalks, right?
  9. https://github.com/DragonGamerDevelopers/NewFantasyMod-1.15.1 here is the link. Edit: I dont have right imported it, wait a bit.
  10. Uh, what is git client and how do you use it?
  11. I only made it yesterday, and I have to admit I should have made it earlier. I'm going to try and get my mod onto Github.
  12. Given what you said, I tried to change using the DeferredRegister, but I got this error, I think it's coming from my entity type, but I don't know why. The Log: Github Link.
  13. I don't understand anything now, register or not?
  14. Here is my Code: Here I created my entity types: package mod.dragonita.fantasymod.init; import mod.dragonita.fantasymod.Main; import mod.dragonita.fantasymod.entities.UnicornEntity; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; import net.minecraftforge.registries.ObjectHolder; @ObjectHolder(Main.MODID) public class ModEntityTypes{ public static EntityType<UnicornEntity> UNICORN = EntityType.Builder .create(UnicornEntity::new, EntityClassification.CREATURE) .size(5F, 7F) .build("unicorn_entity"); } And here I register them: package mod.dragonita.fantasymod; import javax.annotation.Nonnull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.google.common.base.Preconditions; import mod.dragonita.fantasymod.block.InfuserBlock; import mod.dragonita.fantasymod.init.ModBlocks; import mod.dragonita.fantasymod.init.ModEntityTypes; import mod.dragonita.fantasymod.init.ModItemGroups; import mod.dragonita.fantasymod.tileentity.InfuserTileEntity; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.SpawnEggItem; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistryEntry; @EventBusSubscriber(modid = Main.MODID, bus = EventBusSubscriber.Bus.MOD) public final class ModEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(Main.MODID + " Mod Event Subscriber"); @SubscribeEvent public static void onRegisterBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( setup(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2)), "rainbow_ore"), setup(new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(2)), "rainbow_block"), setup(new InfuserBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F)), "infuser") ); } @SubscribeEvent public static void onRegisterItems(RegistryEvent.Register<Item> itemevent) { final IForgeRegistry<Item> registry = itemevent.getRegistry(); //RegistryEvent.Register<EntityType<?>> entityevent = null; //entityevent.getRegistry().registerAll( // ModEntitieTypes.UNICORN_ENTITY_TYPE.setRegistryName(Main.MODID, "unicorn_entity") //); itemevent.getRegistry().registerAll ( setup(new Item(new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)), "rainbow_ingot") ); // Automatically register BlockItems for all our Blocks // (We need to go over the entire registry so that we include any potential Registry Overrides) ForgeRegistries.BLOCKS.getValues().parallelStream() // Filter out blocks that aren't from our mod .filter(block -> block.getRegistryName().getNamespace().equals(Main.MODID)) // You can do extra filtering here if you don't want some blocks to have an BlockItem automatically registered for them // Register the BlockItem for the block .forEach(block -> { // Make the properties, and make it so that the item will be on our ItemGroup (CreativeTab) final Item.Properties properties = new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP); // Create the new BlockItem with the block and it's properties final BlockItem blockItem = new BlockItem(block, properties); // Setup the new BlockItem with the block's registry name and register it registry.register(setup(blockItem, block.getRegistryName())); }); LOGGER.debug("Registered Items"); } @SubscribeEvent public static void onRegisterTileEntityTypes(@Nonnull final RegistryEvent.Register<TileEntityType<?>> event) { // Register your TileEntityTypes here if you have them event.getRegistry().registerAll( // We don't have a datafixer for our TileEntity, so we pass null into build setup(TileEntityType.Builder.create(InfuserTileEntity::new, ModBlocks.INFUSER).build(null), "infuser") ); LOGGER.debug("Registered TileEntityTypes"); } @SubscribeEvent public static void onRegisterEntityTypes(RegistryEvent.Register<EntityType<?>> event) { event.getRegistry().registerAll( ModEntityTypes.UNICORN.setRegistryName(Main.MODID, "unicorn_entity") ); } @SubscribeEvent public static void onRegisterSpawnEggs(RegistryEvent.Register<Item> event) { event.getRegistry().registerAll( setup(new SpawnEggItem(ModEntityTypes.UNICORN, 0xf0f0f0, 0xdf51f5, new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)), "unicorn_entity_egg") ); } /** * Performs setup on a registry entry * * @param name The path of the entry's name. Used to make a name who's domain is our mod's modid */ @Nonnull private static <T extends IForgeRegistryEntry<T>> T setup(@Nonnull final T entry, @Nonnull final String name) { Preconditions.checkNotNull(name, "Name to assign to entry cannot be null!"); return setup(entry, new ResourceLocation(Main.MODID, name)); } /** * Performs setup on a registry entry * * @param registryName The full registry name of the entry */ @Nonnull private static <T extends IForgeRegistryEntry<T>> T setup(@Nonnull final T entry, @Nonnull final ResourceLocation registryName) { Preconditions.checkNotNull(entry, "Entry cannot be null!"); Preconditions.checkNotNull(registryName, "Registry name to assign to entry cannot be null!"); entry.setRegistryName(registryName); return entry; } //@SuppressWarnings("deprecation") //private static <T extends Entity> EntityType<T> register(String key, EntityType.Builder<T> builder) { //return Registry.register(Registry.ENTITY_TYPE, key, builder.build(key)); //} }
  15. I've tried it too, I have to say that (certainly in an unclear way), but I don't know if I'm doing it wrong or anything else, but it crashes the game.
  16. This dont work, I don't know if it's my fault or if I just can't do it. i tried to register it in the same time, but i have got a error, then i tried to register the EntityType before the Item, but it still dont work and if i try to spawn the entity, then the game crashes out and write: Description: Unexpected error But thanks for the Link
  17. I tried spawning my entity, but it did not work and I got this error: Time: 16/01/20 18.17 Description: Unexpected error java.lang.NullPointerException: Unexpected error at net.minecraft.client.renderer.entity.EntityRendererManager.func_229086_a_(EntityRendererManager.java:232) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.WorldRenderer.func_228426_a_(WorldRenderer.java:944) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.func_228378_a_(GameRenderer.java:613) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.renderer.GameRenderer.updateCameraAndRender(GameRenderer.java:435) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.runGameLoop(Minecraft.java:914) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.Minecraft.run(Minecraft.java:520) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:accesstransformer:B,pl:runtimedistcleaner:A} at net.minecraft.client.main.Main.main(Main.java:176) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {re:classloading,pl:runtimedistcleaner:A} at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_231] {} at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_231] {} at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231] {} at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231] {} at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) ~[forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [modlauncher-5.0.0-milestone.4.jar:?] {} at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [modlauncher-5.0.0-milestone.4.jar:?] {} at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) [forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar:?] {} A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Render thread Stacktrace: at net.minecraft.client.renderer.entity.EntityRendererManager.func_229086_a_(EntityRendererManager.java:232) at net.minecraft.client.renderer.WorldRenderer.func_228426_a_(WorldRenderer.java:944) at net.minecraft.client.renderer.GameRenderer.func_228378_a_(GameRenderer.java:613) -- Affected level -- Details: All players: 1 total; [ClientPlayerEntity['Dev'/197, l='MpServer', x=-20.84, y=63.00, z=-15.50]] Chunk stats: Client Chunk Cache: 121, 49 Level dimension: DimensionType{minecraft:overworld} Level name: MpServer Level seed: 4545873244386871167 Level generator: ID 00 - default, ver 1. Features enabled: false Level generator options: {} Level spawn location: World: (0,63,14), Chunk: (at 0,3,14 in 0,0; contains blocks 0,0,0 to 15,255,15), Region: (0,0; contains chunks 0,0 to 31,31, blocks 0,0,0 to 511,255,511) Level time: 24962 game time, 24962 day time Level storage version: 0x00000 - Unknown? Level weather: Rain time: 0 (now: false), thunder time: 0 (now: false) Level game mode: Game mode: creative (ID 1). Hardcore: false. Cheats: false Server brand: forge Server type: Integrated singleplayer server Stacktrace: at net.minecraft.client.world.ClientWorld.fillCrashReport(ClientWorld.java:457) at net.minecraft.client.Minecraft.addGraphicsAndWorldToCrashReport(Minecraft.java:1769) at net.minecraft.client.Minecraft.run(Minecraft.java:539) at net.minecraft.client.main.Main.main(Main.java:176) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at net.minecraftforge.userdev.FMLUserdevClientLaunchProvider.lambda$launchService$0(FMLUserdevClientLaunchProvider.java:55) at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:101) -- System Details -- Details: Minecraft Version: 1.15.1 Minecraft Version ID: 1.15.1 Operating System: Windows 10 (amd64) version 10.0 Java Version: 1.8.0_231, Oracle Corporation Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 688031888 bytes (656 MB) / 3276275712 bytes (3124 MB) up to 7635730432 bytes (7282 MB) CPUs: 4 JVM Flags: 2 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx8192M ModLauncher: 5.0.0-milestone.4+67+b1a340b ModLauncher launch target: fmluserdevclient ModLauncher naming: mcp ModLauncher services: /eventbus-2.0.0-milestone.1-service.jar eventbus PLUGINSERVICE /forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-launcher.jar object_holder_definalize PLUGINSERVICE /forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-launcher.jar runtime_enum_extender PLUGINSERVICE /accesstransformers-2.0.0-milestone.1-shadowed.jar accesstransformer PLUGINSERVICE /forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-launcher.jar capability_inject_definalize PLUGINSERVICE /forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-launcher.jar runtimedistcleaner PLUGINSERVICE /forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-launcher.jar fml TRANSFORMATIONSERVICE FML: 30.0 Forge: net.minecraftforge:30.0.39 FML Language Providers: [email protected] minecraft@1 Mod List: client-extra.jar Minecraft {[email protected] DONE} main Fantasy Mod {fantasymod@version DONE} forge-1.15.1-30.0.39_mapped_snapshot_20190719-1.14.3-recomp.jar Forge {[email protected] DONE} Launched Version: MOD_DEV Backend library: LWJGL version 3.2.2 build 10 Backend API: AMD Mobility Radeon HD 5570 GL version 4.5.13399 Compatibility Profile Context 15.201.1151.1008, ATI Technologies Inc. GL Caps: Using framebuffer using OpenGL 3.0 Using VBOs: Yes Is Modded: Definitely; Client brand changed to 'forge' Type: Client (map_client.txt) Resource Packs: Current Language: English (US) CPU: 4x Intel(R) Core(TM) i3 CPU 550 @ 3.20GHz [m[32m[18:18:04] [Render thread/INFO] [STDOUT/]: [net.minecraft.util.registry.Bootstrap:printToSYSOUT:109]: #@!@# Game crashed! Crash report saved to: #@!@# C:\Users\Christian8\OneDrive - 365education\NewFantasyMod[1.15.1]\run\.\crash-reports\crash-2020-01-16_18.17.57-client.txt I don't understand much of what it says, but if I read it correctly there should be a problem when rendering my entity. Here is the code: package mod.dragonita.fantasymod.client.renders; import mod.dragonita.fantasymod.Main; import mod.dragonita.fantasymod.client.models.UnicornEntityModel; import mod.dragonita.fantasymod.entities.UnicornEntity; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.MobRenderer; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber(modid = Main.MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class UnicornEntityRender extends MobRenderer<UnicornEntity, UnicornEntityModel> { public UnicornEntityRender(EntityRendererManager manager) { super(manager, new UnicornEntityModel(), 0f); } public static final ResourceLocation unicorn = new ResourceLocation("fantasymod:textures/entity/unicorn_entity.png"); public static class RenderFactory implements IRenderFactory<UnicornEntity> { @Override public EntityRenderer<? super UnicornEntity> createRenderFor(EntityRendererManager manager) { return new UnicornEntityRender(manager); } } @Override public ResourceLocation getEntityTexture(UnicornEntity entity) { return unicorn; } } So I register them: package mod.dragonita.fantasymod.client.renders; import mod.dragonita.fantasymod.Main; import mod.dragonita.fantasymod.init.ModEntityTypes; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber(modid = Main.MODID, bus = EventBusSubscriber.Bus.MOD, value = Dist.CLIENT) public class FantasyRenderRegistry { public void registryEntityRenders() { RenderingRegistry.registerEntityRenderingHandler(ModEntityTypes.UNICORN, new UnicornEntityRender.RenderFactory()); } } And here is how I register my SpawnEgg, but there I have to post all the code, here: package mod.dragonita.fantasymod; import javax.annotation.Nonnull; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import com.google.common.base.Preconditions; import mod.dragonita.fantasymod.block.InfuserBlock; import mod.dragonita.fantasymod.init.ModBlocks; import mod.dragonita.fantasymod.init.ModEntityTypes; import mod.dragonita.fantasymod.init.ModItemGroups; import mod.dragonita.fantasymod.tileentity.InfuserTileEntity; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.EntityType; import net.minecraft.item.BlockItem; import net.minecraft.item.Item; import net.minecraft.item.SpawnEggItem; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistryEntry; @EventBusSubscriber(modid = Main.MODID, bus = EventBusSubscriber.Bus.MOD) public final class ModEventSubscriber { private static final Logger LOGGER = LogManager.getLogger(Main.MODID + " Mod Event Subscriber"); @SubscribeEvent public static void onRegisterBlocks(RegistryEvent.Register<Block> event) { event.getRegistry().registerAll ( setup(new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.0F, 3.0F).harvestTool(ToolType.PICKAXE).harvestLevel(2)), "rainbow_ore"), setup(new Block(Block.Properties.create(Material.IRON).hardnessAndResistance(5.0F, 6.0F).sound(SoundType.METAL).harvestTool(ToolType.PICKAXE).harvestLevel(2)), "rainbow_block"), setup(new InfuserBlock(Block.Properties.create(Material.ROCK).hardnessAndResistance(3.5F)), "infuser") ); } @SubscribeEvent public static void onRegisterItems(RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); event.getRegistry().registerAll ( setup(new Item(new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)), "rainbow_ingot"), setup(new SpawnEggItem(ModEntityTypes.UNICORN, 0xf0f0f0, 0xdf51f5, new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)), "unicorn_entity_egg") ); // Automatically register BlockItems for all our Blocks // (We need to go over the entire registry so that we include any potential Registry Overrides) ForgeRegistries.BLOCKS.getValues().parallelStream() // Filter out blocks that aren't from our mod .filter(block -> block.getRegistryName().getNamespace().equals(Main.MODID)) // You can do extra filtering here if you don't want some blocks to have an BlockItem automatically registered for them // Register the BlockItem for the block .forEach(block -> { // Make the properties, and make it so that the item will be on our ItemGroup (CreativeTab) final Item.Properties properties = new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP); // Create the new BlockItem with the block and it's properties final BlockItem blockItem = new BlockItem(block, properties); // Setup the new BlockItem with the block's registry name and register it registry.register(setup(blockItem, block.getRegistryName())); }); LOGGER.debug("Registered Items"); } @SubscribeEvent public static void onRegisterTileEntityTypes(@Nonnull final RegistryEvent.Register<TileEntityType<?>> event) { // Register your TileEntityTypes here if you have them event.getRegistry().registerAll( // We don't have a datafixer for our TileEntity, so we pass null into build setup(TileEntityType.Builder.create(InfuserTileEntity::new, ModBlocks.INFUSER).build(null), "infuser") ); LOGGER.debug("Registered TileEntityTypes"); } //@SubscribeEvent //public static void onRegisterEntitieTypes(RegistryEvent.Register<EntityType<?>> event) //{ //final IForgeRegistry<EntityType<?>> registry = event.getRegistry(); //event.getRegistry().registerAll( //EntityType.Builder.create(UnicornEntity::new, EntityClassification.CREATURE).build(null).setRegistryName(Main.MODID, "unicorn") //FantasyModEntities.UNICORN_ENTITY.setRegistryName(Main.MODID, "unicorn_entity") //); //} /** * Performs setup on a registry entry * * @param name The path of the entry's name. Used to make a name who's domain is our mod's modid */ @Nonnull private static <T extends IForgeRegistryEntry<T>> T setup(@Nonnull final T entry, @Nonnull final String name) { Preconditions.checkNotNull(name, "Name to assign to entry cannot be null!"); return setup(entry, new ResourceLocation(Main.MODID, name)); } /** * Performs setup on a registry entry * * @param registryName The full registry name of the entry */ @Nonnull private static <T extends IForgeRegistryEntry<T>> T setup(@Nonnull final T entry, @Nonnull final ResourceLocation registryName) { Preconditions.checkNotNull(entry, "Entry cannot be null!"); Preconditions.checkNotNull(registryName, "Registry name to assign to entry cannot be null!"); entry.setRegistryName(registryName); return entry; } } But as it is unreadable I will show the parts that are really important: @SubscribeEvent public static void onRegisterItems(RegistryEvent.Register<Item> event) { final IForgeRegistry<Item> registry = event.getRegistry(); event.getRegistry().registerAll ( setup(new Item(new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)), "rainbow_ingot"), setup(new SpawnEggItem(ModEntityTypes.UNICORN, 0xf0f0f0, 0xdf51f5, new Item.Properties().group(ModItemGroups.RAINBOW_MOD_GROUP)), "unicorn_entity_egg") ); @Nonnull private static <T extends IForgeRegistryEntry<T>> T setup(@Nonnull final T entry, @Nonnull final String name) { Preconditions.checkNotNull(name, "Name to assign to entry cannot be null!"); return setup(entry, new ResourceLocation(Main.MODID, name)); } /** * Performs setup on a registry entry * * @param registryName The full registry name of the entry */ @Nonnull private static <T extends IForgeRegistryEntry<T>> T setup(@Nonnull final T entry, @Nonnull final ResourceLocation registryName) { Preconditions.checkNotNull(entry, "Entry cannot be null!"); Preconditions.checkNotNull(registryName, "Registry name to assign to entry cannot be null!"); entry.setRegistryName(registryName); return entry; } LOGGER.debug("Registered Items"); } If anyone is wondering how to register my EntityType, this is what I do: package mod.dragonita.fantasymod.init; import mod.dragonita.fantasymod.entities.UnicornEntity; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityType; import net.minecraft.util.registry.Registry; public class ModEntityTypes extends net.minecraftforge.registries.ForgeRegistryEntry<EntityType<?>>{ public static EntityType<UnicornEntity> UNICORN = register("unicorn_entity", EntityType.Builder.create(UnicornEntity::new, EntityClassification.CREATURE)); @SuppressWarnings("deprecation") private static <T extends Entity> EntityType<T> register(String key, EntityType.Builder<T> builder) { return Registry.register(Registry.ENTITY_TYPE, key, builder.build(key)); } } If it has something to do with my EntityModel, dqnn I have to sqgen dqss I first wanted to see if my code would work, and then add it to my Custom EntityModel, for that I tried the Vanilla Bat Model first, but I would be surprised if that was the problem, but here is the model (I just adapted it a bit): package mod.dragonita.fantasymod.client.models; import com.google.common.collect.ImmutableList; import mod.dragonita.fantasymod.entities.UnicornEntity; import net.minecraft.client.renderer.entity.model.SegmentedModel; import net.minecraft.client.renderer.model.ModelRenderer; public class UnicornEntityModel extends SegmentedModel<UnicornEntity> { private final ModelRenderer batHead; private final ModelRenderer batBody; private final ModelRenderer batRightWing; private final ModelRenderer batLeftWing; private final ModelRenderer batOuterRightWing; private final ModelRenderer batOuterLeftWing; public UnicornEntityModel() { this.textureWidth = 64; this.textureHeight = 64; this.batHead = new ModelRenderer(this, 0, 0); this.batHead.func_228300_a_(-3.0F, -3.0F, -3.0F, 6.0F, 6.0F, 6.0F); ModelRenderer modelrenderer = new ModelRenderer(this, 24, 0); modelrenderer.func_228300_a_(-4.0F, -6.0F, -2.0F, 3.0F, 4.0F, 1.0F); this.batHead.addChild(modelrenderer); ModelRenderer modelrenderer1 = new ModelRenderer(this, 24, 0); modelrenderer1.mirror = true; modelrenderer1.func_228300_a_(1.0F, -6.0F, -2.0F, 3.0F, 4.0F, 1.0F); this.batHead.addChild(modelrenderer1); this.batBody = new ModelRenderer(this, 0, 16); this.batBody.func_228300_a_(-3.0F, 4.0F, -3.0F, 6.0F, 12.0F, 6.0F); this.batBody.setTextureOffset(0, 34).func_228300_a_(-5.0F, 16.0F, 0.0F, 10.0F, 6.0F, 1.0F); this.batRightWing = new ModelRenderer(this, 42, 0); this.batRightWing.func_228300_a_(-12.0F, 1.0F, 1.5F, 10.0F, 16.0F, 1.0F); this.batOuterRightWing = new ModelRenderer(this, 24, 16); this.batOuterRightWing.setRotationPoint(-12.0F, 1.0F, 1.5F); this.batOuterRightWing.func_228300_a_(-8.0F, 1.0F, 0.0F, 8.0F, 12.0F, 1.0F); this.batLeftWing = new ModelRenderer(this, 42, 0); this.batLeftWing.mirror = true; this.batLeftWing.func_228300_a_(2.0F, 1.0F, 1.5F, 10.0F, 16.0F, 1.0F); this.batOuterLeftWing = new ModelRenderer(this, 24, 16); this.batOuterLeftWing.mirror = true; this.batOuterLeftWing.setRotationPoint(12.0F, 1.0F, 1.5F); this.batOuterLeftWing.func_228300_a_(0.0F, 1.0F, 0.0F, 8.0F, 12.0F, 1.0F); this.batBody.addChild(this.batRightWing); this.batBody.addChild(this.batLeftWing); this.batRightWing.addChild(this.batOuterRightWing); this.batLeftWing.addChild(this.batOuterLeftWing); } @Override public Iterable<ModelRenderer> func_225601_a_() { return ImmutableList.of(this.batHead, this.batBody); } @Override public void func_225597_a_(UnicornEntity p_225597_1_, float p_225597_2_, float p_225597_3_, float p_225597_4_, float p_225597_5_, float p_225597_6_) { this.batHead.rotateAngleX = p_225597_6_ * ((float)Math.PI / 180F); this.batHead.rotateAngleY = (float)Math.PI - p_225597_5_ * ((float)Math.PI / 180F); this.batHead.rotateAngleZ = (float)Math.PI; this.batHead.setRotationPoint(0.0F, -2.0F, 0.0F); this.batRightWing.setRotationPoint(-3.0F, 0.0F, 3.0F); this.batLeftWing.setRotationPoint(3.0F, 0.0F, 3.0F); this.batBody.rotateAngleX = (float)Math.PI; this.batRightWing.rotateAngleX = -0.15707964F; this.batRightWing.rotateAngleY = -1.2566371F; this.batOuterRightWing.rotateAngleY = -1.7278761F; this.batLeftWing.rotateAngleX = this.batRightWing.rotateAngleX; this.batLeftWing.rotateAngleY = -this.batRightWing.rotateAngleY; this.batOuterLeftWing.rotateAngleY = -this.batOuterRightWing.rotateAngleY; } } If it is my entity class that is the cause of the problem, then here it is: package mod.dragonita.fantasymod.entities; import net.minecraft.entity.EntityType; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.goal.LookAtGoal; import net.minecraft.entity.ai.goal.LookRandomlyGoal; import net.minecraft.entity.ai.goal.PanicGoal; import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal; import net.minecraft.entity.passive.horse.HorseEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.Hand; import net.minecraft.world.World; public class UnicornEntity extends HorseEntity{ public UnicornEntity(EntityType<? extends UnicornEntity> type, World worldIn) { super(type, worldIn); } protected void registerGoals() { this.goalSelector.addGoal(1, new PanicGoal(this, 1.2D)); this.goalSelector.addGoal(6, new WaterAvoidingRandomWalkingGoal(this, 0.7D)); this.goalSelector.addGoal(7, new LookAtGoal(this, PlayerEntity.class, 6.0F)); this.goalSelector.addGoal(8, new LookRandomlyGoal(this)); } protected void registerAttributes() { super.registerAttributes(); this.getAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(10.0d); this.getAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).setBaseValue(5.0d); } @Override public boolean processInteract(PlayerEntity player, Hand hand) { return super.processInteract(player, hand); } } So, but really, I can't give more information than that, thanks for any help I get.
  18. Sorry but the Versions belower 1.14.4 are not more suported.
  19. Thanks for that information, but there's only one question left: Did your entity have an OBJ file or a normal Json file? I would like to get an OBJ file thanks to the help of a Json file, as for the OBJ Block Models, but I would like to know how you did it if your entity had an OBJ Model or if you just did it with a Classic Java file?
  20. A OBJ Entity that i will be animate.
  21. I want to animate an entity with an OBJ model. You said yourself that you can use an OBJ model with a Json file. So, I want to animate my model with that too, that means that I will write in the Json file which model I want to use, then write the parts that are in the model and that I want to animate and then I will be able to animate it with that too. So I would say from the player perspective.
  22. I have no idea if it could work or not, but I've been trying: public class Test(JsonObject json){ if(json.has("Something")) { System.Out.print("Hi") } } Possible or not
  23. @fury of peppolo It may be that it gives you this error because you are not using the Official Version of Minecraft, if you are using it then it is a problem with your Mod that is not compatible in Multiplayer and you have to update and fix it so that you can play with your friend. Let me know if this helped you.
  24. import mod.dragonita.fantasymod.resources.assets.fantasymod.model.HatModel public class Test(){ public static HatPart = HatModel.HatPart1; } Good afternoon, I was wondering if it is possible to get a part of a model in a Java class. I have a Json Model and I want to animate a certain part of it. Now the big question: would this code work (see below)? If yes or no then let me know. If I have done something wrong please tell me. Thanks for reading it. P.S.: I am writing this from a mobile device, just for info.
×
×
  • Create New...

Important Information

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