Jump to content

Aideux

Members
  • Posts

    20
  • Joined

  • Last visited

Everything posted by Aideux

  1. The one that has an IRenderFactory parameter, of course. It's an interface. You implement it and it will create your renderer when queried. If you do not understand what an interface is or how to implement it then you need to learn Java first. Search the MinecraftForge github repo. Could you please just give me an example? Like I said, I really need visuals to be able to learn and pull apart code for myself. I've done some research, but none of it has been helpful, and I really need this to work. I've tried RenderingRegistry.registerEntityRenderingHandler(EntityGelZombie.class, RenderGelZombie::new); but not only is registerEntityRenderingHandler still not working, RenderGelZombie::new is telling me that the "target type of this expression must be a functional interface". Now, I've also read through some code on github, but none of it seems applicable to what I'm doing, mainly because I can't get RenderGelZombie to act as a functional interface, and I still have no idea if I need to create a separate class IRenderFactory or if I need to initialize my EntityRender class in a different way. I am not much of a Java programmer and I prefer C# when it comes to OOP, but I am in the dark right now and I would really appreciate some concrete examples, rather than just advising me to look online. I mean, there can't be a billion different ways to do this. Thank you again, I really appreciate it.
  2. I don't understand which version of registerEntityRenderingHandler is the factory version, and I've tried both of the available options in both the ClientProxy and preInit methods. Also, I've never heard of IRenderFactory, so I'm not really sure how to implement it into my code. Maybe could you show me how it's used in code so I can better understand it? I'm very much a visual learner! Thank you!
  3. I'm sorry, I'm still super new at this. Do you think you might be able to give me an example of what I should be typing? I'm a very new programmer.
  4. Hey so I've been learning how to render custom Mobs in Minecraft from a book, but the code they use in the book (registerEntityRenderingHandler) is now deprecated. The book said to put this line in the ClientProxy class, but now I'm not so sure how to fix this problem, and every time I try to launch my mod, Minecraft crashes. Can someone please help me out with this? Thank you so much!!! P.S. I've seen posts about this where people recommend using RenderingRegistry#registerEntityRenderingHandler, but I'm not really sure what this means or why there is a pound symbol in the middle of the statement. Can someone also clear this up for me? Thank you so much!!! I'm posting my code just in case the crash was another problem and I'm just a dummy!! Main entity mod code: package com.aideux.mobexample; import com.aideux.basemod.BaseMod; import net.minecraft.client.model.ModelZombie; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; public class MobExample { public static int currentEntityId = 0; public static void preInit() { createEntityWithEgg(EntityGelZombie.class, "CustomMob", 0x00FF00, 0xFF0000); } public static void init() { BaseMod.proxy.registerEntityRenderers(); } public static void createEntityWithEgg(Class entityClass, String entityName, int solidColor, int spotColor) { int entityId = currentEntityId++; EntityRegistry.registerModEntity(entityClass, entityName, entityId, BaseMod.instance, 250, 1, true, solidColor, spotColor); } } ClientProxy class: package com.aideux.basemod; import com.aideux.mobexample.EntityGelZombie; import com.aideux.mobexample.RenderGelZombie; import net.minecraft.client.model.ModelZombie; import net.minecraftforge.fml.client.registry.RenderingRegistry; public class ClientProxy extends CommonProxy { @Override public void registerEntityRenderers() { RenderingRegistry.registerEntityRenderingHandler(EntityGelZombie.class, new RenderGelZombie(new ModelZombie(), 0.5f)); } }
  5. So I gave your test code a shot and now I just fall through the block. I do get withered though haha, but I'm passing right through it like it doesn't exist. [/quot Are you using 1.8.9 or 1.9? My code is for 1.9, for 1.8.9 you'd need to call Block#setBlockBounds with the coordinates instead of creating a static field and overriding Block#getCollisionBoundingBox . I'm using 1.8.9. What's the syntax look like for setBlockBonds as opposed to getCollisionBounding?
  6. So I gave your test code a shot and now I just fall through the block. I do get withered though haha, but I'm passing right through it like it doesn't exist.
  7. So now the player can collide with the top and two sides to produce the wither effect, but the bottom and the remaining two sides do nothing... I'm sorry for being so persistent, but could you please point me in the right direction? Here's my code: float f = 0.125F; return new AxisAlignedBB((double)pos.getX(), (double)pos.getY(), (double)pos.getZ(), (double)((float)(pos.getX() + 1) - f), (double)((float)(pos.getY() + 1) - f), (double)((float)(pos.getZ() + 1) - f));
  8. Hey, I got it to work, thank you! For some reason, however, the wither effect is only added when the entity collides with the top of the block. This may have to do with the fact that I just copied and pasted the collision bounds from the soul sand class, so is there any way I can fix this? Thank you again, I really appreciate you helping me out!
  9. So I looked at the code, and it doesn't seem like there's any explicit method call to make entity collision instantiate the wither effect. Soul Sand doesn't apply the Wither effect, it slows down entities. There are only two methods in BlockSoulSand excluding the constructor: one defines the bounding box (so entities can collide with it), the other slows down entities when they collide with the block. When an entity collides with your block, check if it's an EntityLivingBase and then use EntityLivingBase#addPotionEffect to apply the Wither effect to it. So here's what I've come up with, but it still doesn't work! Can you please help me out? I'm really confused. package com.aideux.cursedblock; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.registry.GameRegistry; public class BlockCursed extends Block { public final String name = "cursedBlock"; public BlockCursed() { super(Material.rock); GameRegistry.registerBlock(this, name); setUnlocalizedName(CursedBlock.MODID + "_" + name); setCreativeTab(CreativeTabs.tabMisc); } public void onEntityWalking(World world, int par2, int par3, int par4, Entity entity) { if(entity instanceof EntityLivingBase) { ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.confusion.getId(), 100, 1)); } } }
  10. So I looked at the code, and it doesn't seem like there's any explicit method call to make entity collision instantiate the wither effect.
  11. Just like the title says, is it possible to make a block that adds the wither status effect upon entity collision? I'm assuming that something would be added to the block constructor, but I'm not entirely sure what the correct terminology is. Can someone point me in the right direction? Thank you!
  12. So how are resource locations formatted? Is it similar to creating variables, or do I have to do something else? I'm sorry for not getting it, I'm really trying to. Again, I really appreciate all your guys' help!
  13. Could you maybe give me an example or edit my code so that I could understand from a more visual standpoint? Thank you!
  14. So, I'm following this book that's been helping me get the basics of Minecraft modding down. The problem is, sometimes I'll run into some outdated information, and I have no idea how to progress. Right now I'm having a problem with ModelBakery.addVariantName being deprecated, and I'm not really sure how the new parameters work (it's suggesting that I use ModelBakery.registerItemVariants instead, but I have no idea how that works), or even if this means that none of my code will work the way that the book teaches it. Can someone please look at my code and tell me how I can fix it efficiently? Just for extra clarity, I'm also adding the .json and .lang files so that if I've done anything wrong, someone could point it out to me! Thank you so much!!! Main code file: package com.aideux.rockmetadataexamples; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.relauncher.Side; @Mod(modid = RockMetadataExamples.MODID, version = RockMetadataExamples.VERSION) public class RockMetadataExamples { public static final String MODID = "aideux_rockmetadataexamples"; public static final String VERSION = "1.0"; public static Item rock; @EventHandler public void preInit(FMLPreInitializationEvent event) { if(event.getSide() == Side.CLIENT) { ItemRock.registerVariants(); } } @EventHandler public void init(FMLInitializationEvent event) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register (rock, 0, new ModelResourceLocation(MODID + ":" + ((ItemRock) rock).getNameFromDamage(0), "inventory")); Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register (rock, 1, new ModelResourceLocation(MODID + ":" + ((ItemRock) rock).getNameFromDamage(1), "inventory")); } } ItemRock class file: package com.aideux.rockmetadataexamples; import java.util.List; import net.minecraft.client.resources.model.ModelBakery; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public class ItemRock extends Item { private static String name = "rock"; private static String[] metaNames = {"green", "black"}; public String getUnlocalizedName(ItemStack par1ItemStack) { return super.getUnlocalizedName()+ "." + metaNames[par1ItemStack.getItemDamage()]; } public static String getNameFromDamage(int damage) { return name + metaNames[damage]; } public static void registerVariants() { String[] variantNames = new String[metaNames.length]; for(int i = 0; i < metaNames.length; i++) { variantNames[i] = RockMetadataExamples.MODID + ":" + getNameFromDamage(i); } ModelBakery.addVariantName(RockMetadataExamples.rock, variantNames); } @SuppressWarnings({"unchecked", "rawtypes"}) @SideOnly(Side.CLIENT) @Override public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) { for(int x = 0; x < metaNames.length; x++) { par3List.add(new ItemStack(this, 1, x)); } } public ItemRock() { GameRegistry.registerItem(this, name); setCreativeTab(CreativeTabs.tabMisc); setHasSubtypes(true); } public String getName() { return name; } } .json for black variant: { "parent": "builtin/generated", "textures": { "layer0": "aideux_seconditemexample:items/rockblack" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55] }, "firstperson": { "rotation": [ 0, -135, 25], "translation": [ 0, 4, 2], "scale": [ 1.7, 1.7, 1.7] } } .json for green variant: { "parent": "builtin/generated", "textures": { "layer0": "aideux_seconditemexample:items/rockgreen" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55] }, "firstperson": { "rotation": [ 0, -135, 25], "translation": [ 0, 4, 2], "scale": [ 1.7, 1.7, 1.7] } } and my .lang file: item.aideux_rockmetadataexamples_rockGreen.name=Green Rock item.aideux_rockmetadataexamples_rockBlack.name=Black Rock Thank you so much again for all your help!!!
  15. I'm pretty new at all of this. Do you think that maybe you could explain how ModelLoader.setCustomModelResourceLocation is better/different from the ItemModelMesher stuff, and how I use it (params, terminology, etc.)? Thank you so much! P.S. Sorry for posting so much in the forum, I'm just trying to get a grasp on how all this works, and I really appreciate the help!
  16. Hey all! So I'll do my best to explain my problem. I'm currently teaching myself how to mod minecraft with that book, "Sam's Teach Yourself Mod Development for Minecraft." I'm on chapter 4, which does a step-by-step on how to create custom items, with names and textures. I've been able to get the custom name to work, but for some reason, no matter what I try or change, the custom texture does not work, and shows the default purple and black box. Here is my current path for my JSON file: "C:\Users\Aidan\Desktop\Minecraft Modding\forge\src\main\resources\assets\aideux_firstItemExample\models\item", and the current path for the texture: "C:\Users\Aidan\Desktop\Minecraft Modding\forge\src\main\resources\assets\aideux_firstItemExample\textures\items". Both the JSON file and the texture file are called "key" with the files extensions .json and .png, respectively. Additionally, here is my main code file: package com.aideux.firstItemExample; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; @Mod(modid = FirstItemExample.MODID, version = FirstItemExample.VERSION) public class FirstItemExample { public static final String MODID = "Aideux_FirstItemExample"; public static final String VERSION = "1.0"; public static Item key; @EventHandler public void preInit(FMLPreInitializationEvent event) { key = new ItemKey(); } @EventHandler public void postInit(FMLPostInitializationEvent event) { if(event.getSide() == Side.CLIENT) { RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); renderItem.getItemModelMesher().register(key, 0, new ModelResourceLocation(MODID + ":" + "key", "inventory")); } } } And here is my external class for ItemKey: package com.aideux.firstItemExample; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class ItemKey extends Item { private String name = "key"; public ItemKey() { GameRegistry.registerItem(this, name); setUnlocalizedName(FirstItemExample.MODID + "_" + name); setCreativeTab(CreativeTabs.tabMisc); } } And finally my JSON file: { "parent": "builtin/generated", "textures": { "layer0": "Aideux_FirstItemExample:items/key" }, "display": { "thirdperson": { "rotation": [ -90, 0, 0], "translation": [ 0, 1, -3 ], "scale": [ 0.55, 0.55, 0.55] }, "firstperson": { "rotation": [ 0, -135, 25], "translation": [ 0, 4, 2], "scale": [ 1.7, 1.7, 1.7] } } } I've gone through the chapter three or four times over the past four hours, but I still can't make heads or tails of it. Can someone please take the time to look through my information and see if they can find a problem? I would really appreciate it, because I am currently completely stumped. Thank you so much!
  17. I tried doing that, but it didn't fix the problem...
  18. Hello! I just downloaded Forge 1.8.9, and put the files "OptiFine_1.8.9_HD_U_H3" and "ShadersMod-v2.4.12mc1.8" into the .mincraft/mods folder. Now for some reason, whenever I run the game, it loads Forge about half way and then crashes. The only way I've seemed to be able to fix this problem is by removing the "ShadersMod-v2.4.12mc1.8" from the mods folder, but I really want to use shaders. I'm really at a loss, and I would appreciate some help! Thank you! Here's the error log: ---- Minecraft Crash Report ---- WARNING: coremods are present: Contact their authors BEFORE contacting forge // Ouch. That hurt Time: 3/2/16 11:51 AM Description: Initializing game java.lang.RuntimeException: Shaders Mod detected. Please remove it, OptiFine has built-in support for shaders. at shadersmod.client.Shaders.checkShadersModInstalled(Shaders.java:4916) at shadersmod.client.Shaders.startup(Shaders.java:1508) at Config.initDisplay(Config.java:203) at net.minecraft.client.renderer.OpenGlHelper.func_77474_a(OpenGlHelper.java:107) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:409) at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:329) at net.minecraft.client.main.Main.main(SourceFile:124) 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:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Stacktrace: at shadersmod.client.Shaders.checkShadersModInstalled(Shaders.java:4916) at shadersmod.client.Shaders.startup(Shaders.java:1508) at Config.initDisplay(Config.java:203) at net.minecraft.client.renderer.OpenGlHelper.func_77474_a(OpenGlHelper.java:107) at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:409) -- Initialization -- Details: Stacktrace: at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:329) at net.minecraft.client.main.Main.main(SourceFile:124) 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:483) at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) at net.minecraft.launchwrapper.Launch.main(Launch.java:28) -- System Details -- Details: Minecraft Version: 1.8.9 Operating System: Windows 10 (amd64) version 10.0 CPU: <unknown> Java Version: 1.8.0_25, Oracle Corporation Java VM Version: Java HotSpot 64-Bit Server VM (mixed mode), Oracle Corporation Memory: 152979664 bytes (145 MB) / 258961408 bytes (246 MB) up to 1060372480 bytes (1011 MB) JVM Flags: 6 total; -XX:HeapDumpPath=MojangTricksIntelDriversForPerformance_javaw.exe_minecraft.exe.heapdump -Xmx1G -XX:+UseConcMarkSweepGC -XX:+CMSIncrementalMode -XX:-UseAdaptiveSizePolicy -Xmn128M IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0 FML: Loaded coremods (and transformers): Launched Version: 1.8.9-forge1.8.9-11.15.1.1764 LWJGL: 2.9.4 OpenGL: Intel® HD Graphics 4600 GL version 4.3.0 - Build 20.19.15.4331, Intel GL Caps: Using VBOs: No Is Modded: Definitely; Client brand changed to 'fml,forge' Type: Client (map_client.txt) Resource Packs: Current Language: ~~ERROR~~ NullPointerException: null Profiler Position: N/A (disabled) CPU: <unknown> OptiFine Version: OptiFine_1.8.9_HD_U_H3 Render Distance Chunks: 12 Mipmaps: 4 Anisotropic Filtering: 1 Antialiasing: 0 Multitexture: false Shaders: null OpenGlVersion: 4.3.0 - Build 20.19.15.4331 OpenGlRenderer: Intel® HD Graphics 4600 OpenGlVendor: Intel CpuCount: 8
×
×
  • Create New...

Important Information

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