Everything posted by Draco18s
-
[1.7.10][1.8] Creating filled_map items pre-populated with data - How?
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; } } }
-
Why are the blocks without tile_Entity loaded and the once with them aren't
Do you have a registered GUI handler? (That is, a class that implements IGuiHandler registered with the NetworkRegistry with registerGuiHandler )
-
[1.7.10] Help with getting raw texture data
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.
-
[1.7.10]How would I get the delta x,y, and z from two entites
Friction! Air resistance!
-
[1.8] Sword help
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?
- [1.8] Sword help
-
Why are the blocks without tile_Entity loaded and the once with them aren't
Show the block class.
-
[1.7.10] Help with getting raw texture data
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
-
[1.7.10] Help with getting raw texture data
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).
-
[1.8] Sword help
Well, you don't have a main mod file (or haven't shown it) so that code is never being called.
-
[1.7.10] onLivingUpdate Entity
how? ... I refer to a vanilla entity ... Subscribe to the event event.setCanceled(true)
-
[1.8] NBTTagCompund on type Item
What does this do, and why is it here? public DNA dna;
-
alc_cleanup: 1 device not closed
And when, pray tell, were you going to fill in that stub?
-
[1.7.10] onNeighbourBlock + oreDict?
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.
-
[1.7.10] onNeighbourBlock + oreDict?
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."
-
[1.7.10] onNeighbourBlock + oreDict?
You don't know what an ItemStack is or how to use it? o..O OreDictionary.getOreID(...) I thought that was pretty obvious.
-
[1.7.10] onNeighbourBlock + oreDict?
Seriously? And "oreIron" is still not an integer. You need getOreID(String name)
-
[1.7.10] onNeighbourBlock + oreDict?
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.
-
[1.7.10] onNeighbourBlock + oreDict?
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!
-
What's the most efficient way to use event handlers?
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 }
-
[1.7.10] ASM Crash
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.
-
[1.7.10]lit_redstone_ore not added in oreDictionary, can't add it.
blockBeingMined.getItemDropped(int, Random, int) and OreDict that instead?
-
TileEntityCustomFurnace player.getDistanceSq((double): player cannot be resolved
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.
-
TileEntityCustomFurnace player.getDistanceSq((double): player cannot be resolved
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
-
Entity Smooth Motion
And thus the jerky movement as position updates are not sent very often. Run the code on the client, as well.
IPS spam blocked by CleanTalk.