-
Posts
16559 -
Joined
-
Last visited
-
Days Won
156
Everything posted by Draco18s
-
First off, your code is not Forge, it's ModLoader. Second, it doesn't like your recipe, I have no idea why, because I don't recognize that usage.
-
First off, your code is not Forge, it's ModLoader. Second, it doesn't like your recipe, I have no idea why, because I don't recognize that usage.
-
TileEntitySpecialRenderer not reacting to Lighting
Draco18s replied to Limpan's topic in Modder Support
int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); That's pulled from the painting renderer, but I'm pretty sure TEs need it too. -
TileEntitySpecialRenderer not reacting to Lighting
Draco18s replied to Limpan's topic in Modder Support
int l = this.renderManager.worldObj.getLightBrightnessForSkyBlocks(i, j, k, 0); int i1 = l % 65536; int j1 = l / 65536; OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, (float)i1, (float)j1); That's pulled from the painting renderer, but I'm pretty sure TEs need it too. -
Missing Method - public Icon getBlockTextureFromSideAndMetadata()
Draco18s replied to rob_bb's topic in Modder Support
Copy and paste your whole class here. -
Missing Method - public Icon getBlockTextureFromSideAndMetadata()
Draco18s replied to rob_bb's topic in Modder Support
Copy and paste your whole class here. -
Correct, damage is on the stack. As for the pickup code, rather than telling the entity that it drops the base item class, tell it to drop a new ItemStack that has all the properties of what the original was, which you'd store as NBT data inside the entity. (Not having dealt with projectiles, I can't really comment more).
-
Correct, damage is on the stack. As for the pickup code, rather than telling the entity that it drops the base item class, tell it to drop a new ItemStack that has all the properties of what the original was, which you'd store as NBT data inside the entity. (Not having dealt with projectiles, I can't really comment more).
-
Minecraft code is a little funky. Item classes are a singleton* instance (as is all Block classes). An ItemStack is a class that allows the entire inventory system to function. Every item in your inventory is a stack of items (even if the stack size is 1). Essentially, it's a wrapper class that allows for instancing of the singleton class. ItemStacks have enchantments, Items don't. *It's actually not, but it's easier to think of it as if it is because it's only ever instanced once.
-
Minecraft code is a little funky. Item classes are a singleton* instance (as is all Block classes). An ItemStack is a class that allows the entire inventory system to function. Every item in your inventory is a stack of items (even if the stack size is 1). Essentially, it's a wrapper class that allows for instancing of the singleton class. ItemStacks have enchantments, Items don't. *It's actually not, but it's easier to think of it as if it is because it's only ever instanced once.
-
Regarding the new Icon system, came across a problem.
Draco18s replied to 0xC6607Eo1's topic in Modder Support
Which is misleading, if not correctly read. Use the term "zip" so it's unambiguous. -
Regarding the new Icon system, came across a problem.
Draco18s replied to 0xC6607Eo1's topic in Modder Support
Which is misleading, if not correctly read. Use the term "zip" so it's unambiguous. -
Regarding the new Icon system, came across a problem.
Draco18s replied to 0xC6607Eo1's topic in Modder Support
Telling someone to perform a jar edit is still bad advice, even if your statement was technically correct. -
Regarding the new Icon system, came across a problem.
Draco18s replied to 0xC6607Eo1's topic in Modder Support
Telling someone to perform a jar edit is still bad advice, even if your statement was technically correct. -
So I have an item that I would like to display in an item frame in a non-standard manner (similar to maps and compasses and not like other items). How would I go about doing this without a base class edit? The first thought is that I could extend ItemMap and then it would count as a map and render as a map, but RenderItemFrame has this: if (entityitem.getEntityItem().getItem() == Item.map) Which precludes that. It looks to see if an item is exactly a vanilla map or vanilla compass, not any other item which might be a subclass. Writing my own renderer is going to do no good, as then it wouldn't be a renderer for Itemframes. If anyone who can do Forge pulls / request such, the above line SHOULD be thus: if (entityitem.getEntityItem().getItem().isMap())
-
So I have an item that I would like to display in an item frame in a non-standard manner (similar to maps and compasses and not like other items). How would I go about doing this without a base class edit? The first thought is that I could extend ItemMap and then it would count as a map and render as a map, but RenderItemFrame has this: if (entityitem.getEntityItem().getItem() == Item.map) Which precludes that. It looks to see if an item is exactly a vanilla map or vanilla compass, not any other item which might be a subclass. Writing my own renderer is going to do no good, as then it wouldn't be a renderer for Itemframes. If anyone who can do Forge pulls / request such, the above line SHOULD be thus: if (entityitem.getEntityItem().getItem().isMap())
-
Regarding the new Icon system, came across a problem.
Draco18s replied to 0xC6607Eo1's topic in Modder Support
Wrong. So very very wrong. When you compile for release, your class files will end up inside /reobf/minecraft/YOUR_PACKAGE You'll create a zip file of YOUR_PACKAGE, then you'll want to add the /mods folder that has your textures in it (so your zip file will contain two things at the root: a folder named YOUR_PACKAGE and one named "mods"). -
Regarding the new Icon system, came across a problem.
Draco18s replied to 0xC6607Eo1's topic in Modder Support
Wrong. So very very wrong. When you compile for release, your class files will end up inside /reobf/minecraft/YOUR_PACKAGE You'll create a zip file of YOUR_PACKAGE, then you'll want to add the /mods folder that has your textures in it (so your zip file will contain two things at the root: a folder named YOUR_PACKAGE and one named "mods"). -
Given that TileEntity blocks extend BlockContainer (not Block) and that CHESTS are tile entities....
-
Given that TileEntity blocks extend BlockContainer (not Block) and that CHESTS are tile entities....
-
[solved] Maps - How do they render their pixels?
Draco18s replied to Draco18s's topic in Modder Support
The ItemMap class is poorly deobfuscated (a lot of "l2" "j1" and so on variable names) and rather complex. My new item extends ItemMap (so I don't have to duplicate the other methods) and am overriding updateMapData to build a different kind of map data. My code is running and producing expected output and saving that output back to mapData.colors[], but none of it renders. I started off by essentially only pulling a single pixel value per chunk (regardless of how many pixels represent that chunk) to start with, and will figure out how much of the chunk area to look at later once I have it working. public void updateMapData(World world, Entity playerEnt, MapData mapData) { if (world.provider.dimensionId == mapData.dimension && playerEnt instanceof EntityPlayer) { short short1 = 128; short short2 = 128; int mapScale = 1 << mapData.scale; int mapxCenter = mapData.xCenter; int mapyCenter = mapData.zCenter; int mapxPos = MathHelper.floor_double(playerEnt.posX - (double)mapxCenter) / mapScale + short1 / 2; int mapzPos = MathHelper.floor_double(playerEnt.posZ - (double)mapyCenter) / mapScale + short2 / 2; int mapRadius = 128 / mapScale; if (world.provider.hasNoSky) { mapRadius /= 2; } MapInfo mapinfo = mapData.func_82568_a((EntityPlayer)playerEnt); ++mapinfo.field_82569_d; for (int mX = mapxPos - mapRadius + 1; mX < mapxPos + mapRadius; ++mX) { if ((mX & 15) == (mapinfo.field_82569_d & 15)) { int l1 = 255; int i2 = 0; double d0 = 0.0D; for (int mZ = mapzPos - mapRadius - 1; mZ < mapzPos + mapRadius; ++mZ) { if (mX >= 0 && mZ >= -1 && mX < short1 && mZ < short2) { int k2 = mX - mapxPos; int l2 = mZ - mapzPos; //boolean flag = k2 * k2 + l2 * l2 > (mapRadius - 2) * (mapRadius - 2); int chunkX = (mapxCenter / mapScale + mX - short1 / 2) * mapScale; int chunkZ = (mapyCenter / mapScale + mZ - short2 / 2) * mapScale; int[] aint = new int[block.blocksList.length]; Chunk chunk = world.getChunkFromBlockCoords(chunkX, chunkZ); if (!chunk.isEmpty()) { int cx = chunkX & 15; int cz = chunkZ & 15; //loops through a chunk at mapscale /*for (int ox = 0; ox < mapScale; ++ox) { for (int oz = 0; oz < mapScale; ++oz) { chunk.getHeightValue(ox + cx, oz + cz) + 1; } }*/ //figure out what color to use //static (black) for sake of example colorIndex = 0; if(mapData.colors[mX + mZ * short1] != colorIndex) { mapData.colors[mX + mZ * short1] = colorIndex; if (l1 > mZ) { l1 = mZ; } if (i2 < mZ) { i2 = mZ; } System.out.println((chunk.xPosition+cx) + "," + (chunk.zPosition+cz) + ":" + colorIndex); } } } } if (l1 <= i2) { mapData.setColumnDirty(mX, l1, i2); } } } } } Edit: As it turns out, it has nothing to do with that function, but the getMapData function. It didn't like me altering how maps make themselves unique: String s = "map_" + par1ItemStack.getItemDamage(); Which I edited to make it unique from normal maps, changing "map_" to another string. -
The ItemMap class is poorly deobfuscated (a lot of "l2" "j1" and so on variable names) and rather complex. My new item extends ItemMap (so I don't have to duplicate the other methods) and am overriding updateMapData to build a different kind of map data. My code is running and producing expected output and saving that output back to mapData.colors[], but none of it renders. I started off by essentially only pulling a single pixel value per chunk (regardless of how many pixels represent that chunk) to start with, and will figure out how much of the chunk area to look at later once I have it working. public void updateMapData(World world, Entity playerEnt, MapData mapData) { if (world.provider.dimensionId == mapData.dimension && playerEnt instanceof EntityPlayer) { short short1 = 128; short short2 = 128; int mapScale = 1 << mapData.scale; int mapxCenter = mapData.xCenter; int mapyCenter = mapData.zCenter; int mapxPos = MathHelper.floor_double(playerEnt.posX - (double)mapxCenter) / mapScale + short1 / 2; int mapzPos = MathHelper.floor_double(playerEnt.posZ - (double)mapyCenter) / mapScale + short2 / 2; int mapRadius = 128 / mapScale; if (world.provider.hasNoSky) { mapRadius /= 2; } MapInfo mapinfo = mapData.func_82568_a((EntityPlayer)playerEnt); ++mapinfo.field_82569_d; for (int mX = mapxPos - mapRadius + 1; mX < mapxPos + mapRadius; ++mX) { if ((mX & 15) == (mapinfo.field_82569_d & 15)) { int l1 = 255; int i2 = 0; double d0 = 0.0D; for (int mZ = mapzPos - mapRadius - 1; mZ < mapzPos + mapRadius; ++mZ) { if (mX >= 0 && mZ >= -1 && mX < short1 && mZ < short2) { int k2 = mX - mapxPos; int l2 = mZ - mapzPos; //boolean flag = k2 * k2 + l2 * l2 > (mapRadius - 2) * (mapRadius - 2); int chunkX = (mapxCenter / mapScale + mX - short1 / 2) * mapScale; int chunkZ = (mapyCenter / mapScale + mZ - short2 / 2) * mapScale; int[] aint = new int[block.blocksList.length]; Chunk chunk = world.getChunkFromBlockCoords(chunkX, chunkZ); if (!chunk.isEmpty()) { int cx = chunkX & 15; int cz = chunkZ & 15; //loops through a chunk at mapscale /*for (int ox = 0; ox < mapScale; ++ox) { for (int oz = 0; oz < mapScale; ++oz) { chunk.getHeightValue(ox + cx, oz + cz) + 1; } }*/ //figure out what color to use //static (black) for sake of example colorIndex = 0; if(mapData.colors[mX + mZ * short1] != colorIndex) { mapData.colors[mX + mZ * short1] = colorIndex; if (l1 > mZ) { l1 = mZ; } if (i2 < mZ) { i2 = mZ; } System.out.println((chunk.xPosition+cx) + "," + (chunk.zPosition+cz) + ":" + colorIndex); } } } } if (l1 <= i2) { mapData.setColumnDirty(mX, l1, i2); } } } } } Edit: As it turns out, it has nothing to do with that function, but the getMapData function. It didn't like me altering how maps make themselves unique: String s = "map_" + par1ItemStack.getItemDamage(); Which I edited to make it unique from normal maps, changing "map_" to another string.
-
Because the only mod I've seen do it is Dynamic Lighting. And it's a coremod.