Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Draco18s

Members
  • Joined

  • Last visited

Everything posted by Draco18s

  1. You'll have to excuse the obfuscated code. This is out of an old, old project (1.6.4 actually) and I never refactored the variable names. ItemMyEmptyMap.java public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { //the string here is the key in a key->value relationship in a HashMap. Really you can use whatever. //the item stack here is important, as this converts the item from the empty map to the filled map. ItemStack itemstack1 = new ItemStack(MapsBase.OreMapItem, 1, par2World.getUniqueDataId("map")); //get a unique name String s = "map_" + itemstack1.getItemDamage(); MapData mapdata = new MapData(s); //this line maps the specific map to its data for save/load par2World.setItemData(s, mapdata); //boring stuff mapdata.scale = 1; int i = 128 * (1 << mapdata.scale); mapdata.xCenter = (int)(Math.round(par3EntityPlayer.posX / (double)i) * (long)i); mapdata.zCenter = (int)(Math.round(par3EntityPlayer.posZ / (double)i) * (long)i); mapdata.dimension = (byte)par2World.provider.dimensionId; mapdata.markDirty(); --par1ItemStack.stackSize; itemstack1.setItemName("Ore Density Map ("+mapdata.xCenter+","+mapdata.zCenter+")"); if (par1ItemStack.stackSize <= 0) { return itemstack1; } else { if (!par3EntityPlayer.inventory.addItemStackToInventory(itemstack1.copy())) { par3EntityPlayer.dropPlayerItem(itemstack1); } return par1ItemStack; } } ItemMyFilledMap.java @Override public void updateMapData(World world, Entity player, MapData mapData) { short short1 = 128; //this line is likely the most important one for you //the MapInfo object is what contains the actual pixel data displayed MapInfo mapinfo = mapData.func_82568_a((EntityPlayer)player); //loop, blah blah for(x) { for(z) { int colorIndex = /*some color*/ mapData.colors[x + z * short1] = colorIndex; } } }
  2. Do you have a registered GUI handler? (That is, a class that implements IGuiHandler registered with the NetworkRegistry with registerGuiHandler )
  3. Yes, but that large texture sheet isn't referenced by anything anywhere. Well, it probably is, but it's buried so deep that I have never been able to find it. As for dealing with OGL, once you have raw pixel data, it's not too bad. I did this by operating on the raw bitmap data (arrays of integers). I actually utilized some code from that project for a block I'm working on, as I wanted to simulate rock fracture planes better than destroyed/not destroyed from explosions. So I snagged the 2D line-drawing code from that project, converted it to handle 3D, and did the research for the 3D rotation of an arbitrary vector around another arbitrary vector (so I could draw 3D lines that went from the destroyed block, away from the explosion, but at a random angular offset). Anyway, towards this problem: Neither will do much good if we can't save the data back into the texture sheet.
  4. Basically: Why the hell did you smash main-mod-file things into your sword class? What the fuck is this line? test_sword = new Item().setUnlocalizedName("test_sword").setCreativeTab(CreativeTabs.tabCombat); Where's your @Mod annotation?
  5. Uh...yeah...
  6. Items can be rendered in two passes as well. https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/item/ItemArtifact.java#L106-147
  7. I was trying to do that (for blocks) months ago and never figured it out. I specifically wanted to pre-multiply two icons so they could be rendered and have correct particles, but gave up and did it as two passes (and have transparent particles).
  8. Well, you don't have a main mod file (or haven't shown it) so that code is never being called.
  9. how? ... I refer to a vanilla entity ... Subscribe to the event event.setCanceled(true)
  10. What does this do, and why is it here? public DNA dna;
  11. And when, pray tell, were you going to fill in that stub?
  12. Because you're not doing it right and no one is just going to write your code for you. You need to understand the functions involved and put the puzzle pieces together yourself. I'm done helping you.
  13. And then you dropped OreDictionary.getOreIDs(neighbourBlock) for no apparent reason. And you're comparing a Block to a boolean. And Ints is not an object or a class. And you're missing a ) It's like you're doing stuff without thinking about what that stuff you're doing means. You're back to a point where you don't even have "code that makes sense, but contains syntax errors."
  14. You don't know what an ItemStack is or how to use it? o..O OreDictionary.getOreID(...) I thought that was pretty obvious.
  15. Seriously? And "oreIron" is still not an integer. You need getOreID(String name)
  16. That is not even close. If anything, you got FATHER away. Now your trying to compare a Block with an int[] Oh, and "ore:oreIron" is still wrong.
  17. Wat. 1) OreDicitionary.getOreIDs(...) requires an ItemStack passed to it. 1 is an integer. 2) ore:oreIron, even if you declared that as a string (which you didn't, so it'll just throw all kinds of errors), that's not the oreDict string for iron ore. 3) Even if it was the correct string, it's not an integer!
  18. I use a variant of #2, myself public void initEventHandlers() { EventHandler evHandle = new EventHandler(); MinecraftForge.EVENT_BUS.register(evHandle); FMLCommonHandler.instance().bus().register(evHandle); //OBJECT REUSE, HEYO }
  19. Might help if you didn't increment through the array. As you remove each instruction, the total count reduces, and your next increment skips over an item. Also, magic numbers like 72 and 82 are a bad idea in general.
  20. blockBeingMined.getItemDropped(int, Random, int) and OreDict that instead?
  21. And important change. And if you knew how to program Java, you'd have caught it on your own long before you went to post here.
  22. Would have been nice if you linked the exact video you were watching. I had to scan through two hours of footage looking for where he puts in that function. What does he do right at 29:13? You did everything he did, except that one thing right at 29:13
  23. And thus the jerky movement as position updates are not sent very often. Run the code on the client, as well.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.