Jump to content

DrEinsteinium

Members
  • Posts

    54
  • Joined

  • Last visited

Everything posted by DrEinsteinium

  1. Hi everyone, I have a strange problem where the models that I add to the game are showing up too low when dropped on the ground. http://img.prntscr.com/img?url=http://i.imgur.com/DlsgosQ.png[/img] Here is my model { "parent":"builtin/generated", "textures": { "layer0":"backpacks:items/backpack" }, "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 ] } } } Any insight on this would be great! Thanks in advance.
  2. The means of acquiring the texture doesn't allow me to do this. I'm rendering parts of player skins into the GUI, and their files are 64x32.
  3. Hey everyone, I am having trouble while creating a new ResourceLocation using a 64x32 file and then rendering that into a Gui. As far as I am aware, a Gui can only use 256x256 ResourceLocation objects, otherwise your whole Gui could possibly get messed up, and nobody wants that. So my question is, what is the equivalent to a ResourceLocation for non 256x256 files, and why is a Gui not capable of rendering smaller? I know it's probably extremely simple, but thanks in advance, Dr E.
  4. FFS. I looked in GL11 for that but for some stupid reason I didn't see it. Thanks for assisting my blind eyes.
  5. Hey guys, I have a ResourceLocation of the player's skin, which as we all know is devised into different sections. The sections I am focusing on right now are the player's head, which are 8x8 squares depicting each side of the head. I want to be able to render these squares into a GUI, but 8x8 is way too small for my needs. So how would I scale up the size of the texture without losing any resolution? Here is what I have right now. //this.size = 8 GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(this.playerskin); // Draw the background layer, aka the player's face. this.drawTexturedModalRect(this.posX, this.posY, 8, 8, this.size, this.size); // Draw the foreground layer, aka the player's hat or mask. this.drawTexturedModalRect(this.posX, this.posY, 40, 8, this.size, this.size); I don't -think- this works, as when you change size to a different number it wont resize the texture but instead resize the "field of vision" (or whatever you prefer to call it) of the renderer. Thanks in advance
  6. Hi, I was wondering if it was possible to get the amount of block/item subtypes from an itemstack. For example, wool has x amount of different colors, and the color is dependent on the metadata number behind the ID. How do I get the amount of metadata numbers wool has? Here is my code so far: Essentially, it takes in this list and puts the itemid:meta into an itemstack and adds it to a hashmap along with the extra data given. public void importList(String url) { String response = this.getResponse(url); String[] l = response.split(","); for(int i = 0; i < l.length; i++) { String[] itmid = l[i].split("="); String[] metad = itmid[0].split(":"); boolean all = false; ItemStack item = new ItemStack(Integer.valueOf(metad[0].replace("null", "")), 1, 0); if(metad.length > 1 && metad[1] != null) {if(metad[1].contains("*")) all = true; else item.setItemDamage(Integer.valueOf(metad[1])); } if(all) for(int x = 0; x < item.getItemDamage(); x++) { item.setItemDamage(x); PluginRegistrar.registerYoutube(item, itmid[1]); } else { PluginRegistrar.registerYoutube(item, itmid[1]); } } } For some reason, the item.getMaxDamage() method does not work for this and I am not sure why. However, it does work for items such as tools that have thousands of different damage values in their metadata. Thanks.
  7. Hi everyone, I was wondering how to manage/localize your mod in Minecraft through the use of lang files, which is how vanilla does it, but I can't find anything regarding how it works in the code, but here is what I've got already. I already know of the LanguageRegistry class, and I know how to register things using LanguageRegistry.instance().addStringLocalization("a.locale.itemthing", "en_US", "Localized Name"); but how do I reference them in my code? Like this? LanguageRegistry.instance().getStringLocalization("a.locale.itemthing", "en_US"); So those are the meat and potatoes, but how do I load a series of lang files? Do I need to have them all in a package and load them on runtime with some special loops? Or is there an automatic way to do it? Thanks in advance,
  8. I've seen yours ben. You inspired me to make mine into a widget, however mine isn't as fancy as yours, because you clip the buttons >.>; <3 Here is my git. I managed to get the click/drag working with the built in methods of GuiContainer. Now I just have to write the algorithm to scroll through my buttons. https://github.com/DrEinsteinium/WikiLink/blob/master/com/dreinsteinium/wikilink/gui/GuiContainerMenu.java https://github.com/DrEinsteinium/WikiLink/blob/master/com/dreinsteinium/wikilink/gui/widget/WidgetScrollPane.java
  9. Thanks for the example. I've gotten the mouse wheel to work but I'm a little bit confused with the actually clicking and dragging of the scroll bar. Can you explain how it works?
  10. Hey everyone, I have been trying to add a scroll bar to my GUI for a while now but with no luck, and I was curious if someone would take the time to write a detailed tutorial for it. I and many other would appreciate it, and it would be a great contribution to the community. As for what it's scrolling through, you could have it scroll through anything from a list of GUI slots to a list of GuiButtons, or even a list of pictures. Thank you so much.
  11. Did you make sure to add it into your buildpath? Finding it in eclipse and right clicking > buildpath> add to buildpath is what I have to do in order to use a library from NEI.
  12. I was actually trying to see if I created a new instance of the same entity if it would give me the correct Id, as it works for a lot of my other code. I've removed that part now. Here is my completed code. World world = Minecraft.getMinecraft().theWorld; try { if(Minecraft.getMinecraft().objectMouseOver != null) if(Minecraft.getMinecraft().objectMouseOver.entityHit != null) { if(Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityLiving) {Entity entity = (EntityLiving)Minecraft.getMinecraft().objectMouseOver.entityHit; //The ItemStack to pass to the GUI //Since it's an entity, I pass a monster egg. ItemStack item = new ItemStack(Item.monsterPlacer); item.setItemDamage(EntityList.getEntityID(entity)); FMLClientHandler.instance().getClient().displayGuiScreen(new GuiContainerMenu(item)); } } else if(world.blockExists(Minecraft.getMinecraft().objectMouseOver.blockX, Minecraft.getMinecraft().objectMouseOver.blockY, Minecraft.getMinecraft().objectMouseOver.blockZ)) { int worldX = Minecraft.getMinecraft().objectMouseOver.blockX; int worldY = Minecraft.getMinecraft().objectMouseOver.blockY; int worldZ = Minecraft.getMinecraft().objectMouseOver.blockZ; int id = world.getBlockId(worldX, worldY, worldZ); ItemStack item = new ItemStack(Block.blocksList[id]); FMLClientHandler.instance().getClient().displayGuiScreen(new GuiContainerMenu(item)); } } catch(Exception e) { e.printStackTrace(); }
  13. Thank you both for your answers, as I could have gotten them both to work, but GotoLink's solution was the easiest. As for entities from other mods MobId's however, they work, because all entities that can be spawned through mob eggs(which are added by default in forge) get added to the EntityList class. Thanks
  14. World world = Minecraft.getMinecraft().theWorld; try { if(Minecraft.getMinecraft().objectMouseOver != null) if(Minecraft.getMinecraft().objectMouseOver.entityHit != null) { if(Minecraft.getMinecraft().objectMouseOver.entityHit instanceof EntityLiving) {Entity entity = (EntityLiving)Minecraft.getMinecraft().objectMouseOver.entityHit; Entity entity1 = entity.getClass().getConstructor(new Class[] {World.class}).newInstance(new Object[] {world}); //The ItemStack to pass to the GUI //Since it's an entity, I pass a monster egg. ItemStack item = new ItemStack(Item.monsterPlacer); item.setItemDamage(entity1.entityId); WikiLink.LogHelper.info("Mob Id " + entity1.entityId); //FMLClientHandler.instance().getClient().displayGuiScreen(new GuiContainerMenu(item)); } } } catch(Exception e) { e.printStackTrace(); } So, using that code, I want to be able to get the "EntityId" of the entity the player is looking at, which works, but it's not the EntityId that I want. I want the integer of the entity that corresponds to the metadata on the spawn eggs. Ex: For IronGolem it is 383:99, yet it returns the unique entity id of the entity in the world, which is some crazy number such as 98741. If anyone has any insight on this, please help, I'm desperate. ;P Cheers,
  15. Hey everyone. I've been fiddling around with NBTTagCompounds lately and I can't quite decipher entirely how it works. I am currently making a pretty simple item that stores the number of entities killed and adds to the number every time a monster is killed by the player Here is my code. @ForgeSubscribe public void soulBagListener(LivingDeathEvent event) { if(event.source.getDamageType().equals("player") && event.entityLiving instanceof EntityMob) { EntityPlayer player = (EntityPlayer)event.source.getEntity(); String entityLivingName = event.entityLiving.getEntityName(); for(int i = 0; i < player.inventory.getSizeInventory(); i++) { if(player.inventory.getStackInSlot(i) != null) if(player.inventory.getStackInSlot(i).getItem() instanceof ItemSoulBag) { ItemStack item = player.inventory.getStackInSlot(i); NBTTagCompound nbt = item.getTagCompound(); if(nbt == null) item.setTagCompound(new NBTTagCompound()); if(!nbt.hasKey("tsouls")) nbt.setInteger("tsouls", 0); nbt.setInteger("tsouls", nbt.getInteger("tsouls") + 1); if(!nbt.hasKey("tsouls" + "-" + entityLivingName)) nbt.setInteger("tsouls" + "-" + entityLivingName, 0); nbt.setInteger("tsouls" + "-" + entityLivingName, nbt.getInteger("tsouls" + "-" + entityLivingName) + 1); return; } } } } Essentially, it loops through all of the inventory slots and finds the first SoulBagItem, then executing the code. The first part of the code adds +1 to the "total soul count" named "tsouls" which is displayed rather easily on the ItemStack's tooltip. That part is easy. The second part of the code adds a +1 to the "specific mob soul count" named "tsouls-" + entity name. This is what I am having trouble with, as I highly doubt this is how NBT tag compounds should work. I want to loop through the NBTTagCompound and add each entity specific counts to the tooltip as well, but I can't do that with my current system. Can anyone explain to me what I am doing wrong or critique my system? And also help me understand the differences between 1. NBTTagCompound 2. NBTTagList - specifically "subtag" 3. NBTBase And before I possibly get flamed, I have looked at a fairly decent tutorial on the MC forums, as well as the Forge wiki, but they don't explain everything. Thanks in advance, Dr. E.
  16. Hey everyone, I've been messing with the Forge events lately and I like them. A lot. Except that some events do not exist such as a piston update event, or player fishing event. Am I just missing something important about events or would I perhaps have to make a new type of event that listens for things such as this. I would really like to know! Thanks in advance, Doc.
  17. Hey guys, I got a tricky one for you today... I have an error in my code, yet it does not show up in Eclipse while running the game from my workspace. It only shows up when I export my modification and run it through the Minecraft launcher. Whenever I try to launch the GUI through the launcher it gives me a no such field error from the constant "width" whenever it reaches that line. I have compared my code to many different examples and yet it still will not work. For starters: 1. I made sure that the Minecraft Forge versions in my workspace and client were the same. I double and even triple checked them after reinstalling both. Someone suggested that the code could be out of sync, but it is not the case. Forge Build # (For both Launcher and Workspace) forge.major.number=9 forge.minor.number=11 forge.revision.number=1 forge.build.number=916 2. Before, I had every reference to the width and height constant of the GUI referred to with "this.", and when I remove that keyword is does not make a difference. The game still crashes. 3. I have packaged my mod correctly based on the packaging in eclipse. Assets folders and mod folders are all in the correct places. So here is the pastebin of the situation: http://pastebin.com/DE5y3dKA To sum it up, I get java.lang.NoSuchFieldError: width at co.einsteinium.wikilink.gui.GuiContainerWikiLinkMenu.func_73866_w_(GuiContainerWikiLinkMenu.java:64) Here is the code file: GitHub I would really appreciate any help on this, as I have no idea what the heck is going on. It seems like I have done everything right, but obviously not. Thanks in advance,
  18. In simple terms, how would using these functions effect the integrity of the mod? My mod doesn't add any items/blocks, but I do use the similar functions like ItemStack.itemID to reference items added to the game in my code in order to display correct information about them in a GUI. This is essentially the core functionality of my mod and it would be a shame if I couldn't use these functions.
  19. I hate to say this but it sounds like you're either going to have to create your own control menu(easier) or edit the base control menu class by making a coremod. Those are the only two options I can think of.
  20. None of these solutions are working and I have no idea why. I have essentially exhausted all of the tutorials I can find with no luck. Does anyone have any other ideas?
  21. I think that is where my problem lies. I am loading from a zip file located in ./mods/WikiLink/ which means these classes are not loaded into the classpath at all. I don't know how to load them or even how to get the correct directory. All I am doing is mainly guesswork.
  22. So it sounds like you are dealing with "obfuscated" class files. When Minecraft recompiles it's code it uses a system that essentially makes all class names, methods and fields almost unusable by renaming and refactoring them to names such as aab, aac, ect. This would explain why your import statements would include these weird names. But as for fixing these, it's nearly impossible with the information you have given us so far. What mod is it that you are trying to update? Is it open source? If not, where did you get it's source from? Did you install Forge correctly? Without this information none of us can really help you. Cheers,
  23. Hey guys, I am working on WikiLinkLib, a small zip library of class files implementing my Plugin interface. I am making it so this zip file will not load with all other mods, but my mod will load it AFTER it downloads and updates (if needed). To achieve this I am trying to use a classloader that loads all classes from a zip but I am getting an annoying error. I have tried everything I can think of but for some reason I can not figure it out. Here is my LibraryHandler class. This class essentially pulls the class files from the ZIP archive and sends them to the class loading method inside of my PluginManager. public class LibraryHandler { public static void loadLibClasses(File dir) { try { ZipEntry entry = null; File file = new File(dir.getCanonicalFile() + File.separator + "WikiLinkLib.zip"); final FileInputStream fileIO = new FileInputStream(file); final ZipInputStream zipIO = new ZipInputStream(fileIO); while(true) { entry = zipIO.getNextEntry(); if(entry == null) { fileIO.close(); break; } final String entryName = entry.getName(); final File entryFile = new File(entryName); final String pluginName = entryFile.getName(); final ClassLoader loader = WikiLink.class.getClassLoader(); if(!entry.isDirectory() && pluginName.startsWith("Plugin") && pluginName.endsWith(".class")) { PluginManager.initWikiLinkLib(loader, pluginName, entryFile.getPath().replace(File.separator, ".")); } } } catch(Exception e) { e.printStackTrace(); } } } Here is the method in my PluginManager that loads(or is supposed to) the classes. private static void addPlugin(final ClassLoader classLoader, final String pluginName, final String packageName) { if (pluginName.equals("PluginManager.class") || pluginName.equals("Plugin.class")) { return; } final String pluginClassName = packageName.replace(".class", ""); try { final Class<?> pluginClass = classLoader.loadClass(pluginClassName); if (pluginClass != null) { Class<?> clz = pluginClass; boolean isPlugin = false; do { for (final Class<?> i : clz.getInterfaces()) if (i == Plugin.class) { isPlugin = true; break; } clz = clz.getSuperclass(); } while (clz != null && !isPlugin); if (!isPlugin) { return; } final Plugin plugin = (Plugin) pluginClass.newInstance(); if (plugin != null) { INSTANCE.plugins.add(plugin); if (plugin instanceof IFuelHandler) { GameRegistry.registerFuelHandler((IFuelHandler) plugin); } } } } catch (final Exception ex) { WikiLink.LogHelper.info("Cannot load class " + pluginClassName); ex.printStackTrace(); } } For the ClassLoader I am using the ClassLoader of my main mod file WikiLink. This will essentially just call the ClassLoader for Forge. I am not sure if this is how it is supposed to work but I don't know any other way. Here is the stacktrace: http://pastebin.com/jaFkbDWK The only Plugin file in my ZIP archive is co.einsteinium.wikilinklib.plg.PluginMinecraftWiki.class If there is anyone that can enlighten me on classloading w/ forge then I would really appreciate it. This is the first time I've really ever messed with classloading so I am a bit new. Thanks in advance, Dr. E.
  24. I noticed that GuiContainer is missing after reading the logs fairly carefully. NEI replaces(or is supposed to) replace GuiContainer because it's a coremod, but it seems to have nuked my workspace. I've compiled this many times before successfully but for some reason NEI is just being crazy. I have already sent a message to good ol' CB, perhaps he will have an answer for me. Thanks for the replies guys.
  25. Hey everyone. I have just finished my newest build for 1.6.4 after updating my mod. I added a new GUI before I released the upgrade and everything was working fine in eclipse. When I go to export my mod it gives me a huge 100+ error log in the recompile script. It's giving me a lot of errors in files I have NEVER touched before such as some vanilla classes. Has anyone ever gotten this before, and if so, what the heck did I do to nuke the source so hard? Error Log -> http://pastebin.com/FPg6rg62 Thanks in advance
×
×
  • Create New...

Important Information

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