Jump to content

GenFrogKing

Members
  • Posts

    10
  • Joined

  • Last visited

Everything posted by GenFrogKing

  1. That was it! I will strive towards being more aware of these sorts of simple mistakes. Thank you for your help and patience!
  2. Lol, I don't wish a heated debate this early in my Java career. Included it, but still no go. private static final ResourceLocation stoneRockTexture = new ResourceLocation(Main.MOD_ID + "/textures/items/stone_rock.png"); Hmmmm...
  3. Hey, thanks all again for the replies. If what you're saying is true, then the problem should be in how I'm calling the texture in my Render class, right? RenderStoneRock class: Upon putting an Override annotation on the first getEntityTexture method, I receive an error stating that that specific method is nonexistent in the extended class for the given parameters. That should be fine for custom methods, though... right? I tested this class with several System.out.println's and I know for a fact that everything here is being called including this unrecognized method. However, there is an error upon "throwing" the rock: It would appear you're right, gegy1000. I've tried modifying the load path with no success thus far. I'm sure it's something simple from here, though. I'm investigating. Alright, alright, you caught me again, but I thought you said Eclipse didn't offer automated overriding...
  4. Thank you very much for the replies! Okay, so upon searching for onRightClick in Item class, I discovered that it didn't exist. I scrolled down and found onItemRightClick. Quite a silly blunder! I bet you guys saw it and were just waiting to see how long it would take me. I also commented out the part TrashCaster mentioned. The rock is mostly throw-able now. However, now my rock isn't rendering properly. It's just a black and purple checker box when it leaves the character's hands. It probably has something to do with the Entities class. I suspect I'm registering the renders wrong. It also could very well have something to do with the way my proxies relate to the Main class. Either way, somehow RenderStoneRock isn't being called right. I'm troubleshooting, but will have more time this coming weekend to really look into it if I don't solve it tonight.
  5. Thanks for the reply. Upon getting the RenderManager, the error disappeared. However, the item is still not rendering upon right clicking. In fact, only while I'm in creative mode does my avatar's arm twitch at all. I've scanned and compared my Item's class to other's. I can't seem to find an error. Stone Rock Entity class: I really don't think the problem is in this class, but rather in the way I'm handling the rendering of the entity. The problem must still lie in one of my main mod classes. Main mod class: Common Proxy class: Server Proxy Class: Client Proxy Class: Entities Class: Stone Rock Item: Any help is greatly appreciated!
  6. Ok, so I've been trying to make this simple rock throwable. My problem is this: Why isn't it working? Here's my code thus far: Mod Class: package genfrogking.supercraft; import genfrogking.supercraft.init.SupercraftBlocks; import genfrogking.supercraft.init.SupercraftEntities; import genfrogking.supercraft.init.SupercraftItems; import genfrogking.supercraft.init.SupercraftRecipes; import genfrogking.supercraft.proxy.CommonProxy; import genfrogking.supercraft.worldGen.WorldRegister; import net.minecraft.creativetab.CreativeTabs; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Reference.MOD_ID, name = Reference.MOD_NAME, version = Reference.VERSION) public class SupercraftMod { @SidedProxy(clientSide = Reference.CLIENT_PROXY_CLASS, serverSide = Reference.SERVER_PROXY_CLASS) public static CommonProxy proxy; public static final SupercraftTab tabSupercraft = new SupercraftTab("tabSupercraft"); @EventHandler // This is called when Forge is setting up. public void preInit(FMLPreInitializationEvent PreEvent) { // Object init and registering // Config handling SupercraftBlocks.init(); SupercraftBlocks.register(); SupercraftItems.init(); SupercraftItems.register(); SupercraftEntities.init(); SupercraftEntities.register(); SupercraftRecipes.addRecipes(); WorldRegister.MainRegistry(); } @EventHandler public void Init(FMLInitializationEvent Event) { // Proxy, TileEntity, entity, GUI, Sounds, Packet Registering proxy.registerRenders(); proxy.registerSounds(); } @EventHandler public void PostInit(FMLPostInitializationEvent PostEvent) { } } Entities Class: package genfrogking.supercraft.init; import genfrogking.supercraft.Reference; import genfrogking.supercraft.client.renderer.entity.RenderStoneRock; import genfrogking.supercraft.init.entity.projectile.EntityStoneRock; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.entity.RenderSnowball; import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.world.World; import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.common.registry.EntityRegistry; public class SupercraftEntities { public static Entity stone_rock; public static void init() { } public static void register() { EntityRegistry.registerModEntity(EntityStoneRock.class, "stone_rock", 4, 0, 80, 3, true); } public static void registerRenders() { RenderingRegistry.registerEntityRenderingHandler(EntityStoneRock.class, new RenderStoneRock(stone_rock)); } public static void registerRender(Entity entity) { } } In that last class, Eclipse is throwing a red flag on line 30 (where I start with RenderingRegistry) and is underlining RenderStoneRock(stone_rock) as the problem source at the moment. It says that there is no constructor that takes the same parameters which is true; I'm guessing things changed in 1.8. (I've been following a 1.7.10- tutorial on throwable items). Here is the RenderStoneRock class. RenderStone Rock class: package genfrogking.supercraft.client.renderer.entity; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.entity.Render; import net.minecraft.client.renderer.entity.RenderItem; import net.minecraft.client.renderer.entity.RenderManager; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class RenderStoneRock extends Render { protected final Item something; private final RenderItem somethingElse; private static final String reallyDontKnow = "someString"; public RenderStoneRock(RenderManager renderManager, Item item, RenderItem renderItem) { super(renderManager); this.something = item; this.somethingElse = renderItem; } public ItemStack func_177082_d(Entity entity) { return new ItemStack(this.something, 1, 0); } public void doRender(Entity entity, double x, double y, double z, float p_76986_8_, float partialTicks) { GlStateManager.pushMatrix(); GlStateManager.translate((float)x, (float)y, (float)z); GlStateManager.enableRescaleNormal(); GlStateManager.scale(0.5F, 0.5F, 0.5F); GlStateManager.rotate(-this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F); GlStateManager.rotate(this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F); this.bindTexture(TextureMap.locationBlocksTexture); this.somethingElse.renderItemModel(this.func_177082_d(entity)); GlStateManager.disableRescaleNormal(); GlStateManager.popMatrix(); super.doRender(entity, x, y, z, p_76986_8_, partialTicks); } @Override protected ResourceLocation getEntityTexture(Entity entity) { return null; //return TextureMap.locationBlocksTexture; } } So the RenderStoneRock() method now takes three objects. How do I account for these in my Entities class file? I can provide more code of what's going on in my other class files if need be. However, since the red flag is in the Entities class, I'm guessing once that's solved, it will work.
  7. I'm a bit new to all of this, so I may butcher exact language pretty badly here. (I appreciate being corrected by knowers.) Thus I go! 1. I believe the super() method you're referring to is defining the constructor used in the extended ItemArmor java. This is why you're required to define it in your custom Armor class perhaps exactly like xwerswoodx has done. If you're using Eclipse, you can hold Ctrl, mouse over super and click Open Implementation. It will show you why this needs to be defined in your custom Armor. 2. The getArmorTexture is a process (or function if you will) that is provided in the ItemArmor java as well. If you're using Eclipse, you can hold Ctrl, mouse over getArmorTexture and click Open Super Implementation. It will open the ItemArmor java file and direct you straight to this function- this is why we're able to utilize it in your custom class. You will deal with your Armor items in your Mod's Item's class perhaps entirely like this... public class YourModItems { public static Item mithril_helmet; public static Item mithril_chestplate; public static Item mithril_boots; public static Item mithril_leggings; public static final ItemArmor.ArmorMaterial mithrilArmorMaterial = EnumHelper.addArmorMaterial("mithirlArmorMaterial", "mithrilArmorMaterial", 3000, new int[]{4,10,7,5}, 30); public static void init() { mithril_helmet = new ItemMithrilArmor(mithrilArmorMaterial, 0, 0).setUnlocalizedName("mithril_helmet").setCreativeTab(SupercraftMod.tabSupercraft); mithril_chestplate = new ItemMithrilArmor(mithrilArmorMaterial, 0, 1).setUnlocalizedName("mithril_chestplate").setCreativeTab(SupercraftMod.tabSupercraft); mithril_leggings = new ItemMithrilArmor(mithrilArmorMaterial, 0, 2).setUnlocalizedName("mithril_leggings").setCreativeTab(SupercraftMod.tabSupercraft); mithril_boots = new ItemMithrilArmor(mithrilArmorMaterial, 0, 3).setUnlocalizedName("mithril_boots").setCreativeTab(SupercraftMod.tabSupercraft); } public static void register() { GameRegistry.registerItem(mithril_helmet, mithril_helmet.getUnlocalizedName().substring(5)); GameRegistry.registerItem(mithril_chestplate, mithril_chestplate.getUnlocalizedName().substring(5)); GameRegistry.registerItem(mithril_leggings, mithril_leggings.getUnlocalizedName().substring(5)); GameRegistry.registerItem(mithril_boots, mithril_boots.getUnlocalizedName().substring(5)); } public static void registerRenders() { registerRender(mithril_helmet); registerRender(mithril_chestplate); registerRender(mithril_leggings); registerRender(mithril_boots); } public static void registerRender(Item item) { Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, 0, new ModelResourceLocation(Reference.MOD_ID + ":" + item.getUnlocalizedName().substring(5), "inventory")); } } 3. Tip: Get into the habit of scouring the code yourself because easy questions like this can put some people out. The trick is, of course, knowing when something is simple and when it might require some help . For example, what a typical json file looks like is easy to discover by opening your forge minecraft assets folder. My directory is: forgeSrc-yourVersion/assets/minecraft/models/item/ this would be the directory you would look to find json files for typical items like armor. Json files are stored in the forgeSrc-yourVersion/assets/minecraft/models directory. In the item folder, open material_helmet.json, copy that code into a new text file, and save it appropriately. If this is still confusing for you, search on YouTube for Mr. Crayfish's 1.7 modding series- episode 12 deals with armor and he steps you through things. Hope this resolves your issues.
  8. Yup, that was it. Thank you! When you say are you referring to auto-organizing (Ctrl-Shift-O) imports in Eclipse? It automatically imported scala for me instead of java; I didn't even notice! Fortunately, Eclipse noticed there was an error here.
  9. As the name suggests, I simply wish to have a block drop an item- specifically, this is an ore block meant to drop minerals when mined. (Below is the code.) I'm sure it's a simple fix, but I've been googling for a day now (minus time spent sleeping and at work) and scouring this forum without any luck. There's plenty of 1.7+ tutorials/code out there that use the getItemDropped(int metadata, Random random, int fortune) implementation from the Block class which has changed to getItemDropped(IBlockState state, Random random, int fortune). I updated to the new implementation, but the @Override above both getItemDropped and quantityDropped apparently doesn't belong even though Ctrl-clicking on them allows me to open them in the Block class directory. This is a bit frustrating. I'm using Eclipse and I'm a bit new to Java but not to coding (and I've been reading up with a Sam's). Thank you for any help! The Code package genfrogking.supercraft.init.blocks; import java.lang.annotation.Target; import genfrogking.supercraft.init.SupercraftItems; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import scala.util.Random; public class Block_Ore_Mithril extends Block { public Block_Ore_Mithril(Material materialIn) { super(materialIn); this.setResistance(25.0F); this.setHardness(5.0F); this.setHarvestLevel("pickaxe", 4); this.setLightLevel(1.0F); this.setLightOpacity(0); } @Override public Item getItemDropped(IBlockState state, Random rand, int fortune) { return SupercraftItems.mithril_mineral; } @Override public int quantityDropped(Random rand) { return 1 + rand.nextInt(2); } } Sorry. I tried to put the code in a spoiler and code format, but the formatting options, when I was setting this post up, weren't working properly.
×
×
  • Create New...

Important Information

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