Jump to content

DrEinsteinium

Members
  • Posts

    54
  • Joined

  • Last visited

Converted

  • Gender
    Male
  • URL
    http://www.catacombs.co
  • Location
    Atlanta, GA
  • Personal Text
    Creator of WikiLink

DrEinsteinium's Achievements

Stone Miner

Stone Miner (3/8)

1

Reputation

  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.
×
×
  • Create New...

Important Information

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