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. Try this: world.spawnEntityInWorld(new EntityItem(world, x, y, z, new ItemStack(Item.bow))); Just replace Item.bow with the item you want to spawn. Make sure to check that the world isn't remote, or you'll end up with a phantom item as well.
  2. This helped me get solved too. We were in fact both making the same mistakes! http://s8.postimg.org/f4ybhigdh/2013_03_29_20_54_34.png[/img] Woo, mosaics!
  3. I'm too humble to do that. Thhhb.
  4. I've been modding for about two weeks. o..o; As for scrupulous...not sure. I just use the code hinting excessively. "Is there a function to do...?" and check the various objects I have access to. Also, I figured out I didn't need to save a reference to the World. World implements IBlockAccess, so you can pass it to your lighting function from within updateTick: public void updateTick(World world, int x, int y, int z, Random par5Random) { getLightValue(world, x, y, z); } And you do need to call that function in the update, or it won't be recalculated.
  5. Technically the code I use makes a call to getCelestialAngle. Just not directly: World.java public int calculateSkylightSubtracted(float par1) { float var2 = this.getCelestialAngle(par1); float var3 = 1.0F - (MathHelper.cos(var2 * (float)Math.PI * 2.0F) * 2.0F + 0.5F); if (var3 < 0.0F) { var3 = 0.0F; } if (var3 > 1.0F) { var3 = 1.0F; } var3 = 1.0F - var3; var3 = (float)((double)var3 * (1.0D - (double)(this.getRainStrength(par1) * 5.0F) / 16.0D)); var3 = (float)((double)var3 * (1.0D - (double)(this.getWeightedThunderStrength(par1) * 5.0F) / 16.0D)); var3 = 1.0F - var3; return (int)(var3 * 11.0F); }
  6. Lighting up in the dark "and being bright all the time" are largely indistinguishable, because of the way lighting works.
  7. Did you run it? Note that this line: int a = theWorld.calculateSkylightSubtracted(0); //force calculation of current lighting levels Gets how much below 15 the current light level is (note the SUBTRACTED part). Oddly I didn't find the "get current light level" function. Either I missed seeing it, or it's part of a different class.
  8. IBlockAccess is an interface. It supplied a handful of methods that might be relevant for that function call. It's like World-lite. In any case, I found that IBlockAccess was insufficient for the desired effect. Here's what I ended up with: public class GlowFlower extends Block { //If you want a flower as per flower, extend BlockFlower. I wanted mine to be placable under water, so I couldn't. protected static World theWorld; public GlowFlower(int par1, int par2, Material par3Material) { super(par1, par2, par3Material); setBlockName("Glow Moss"); setStepSound(soundGrassFootstep); setTickRandomly(true); float var4 = 0.2F; setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var4 * 3.0F, 0.5F + var4); setCreativeTab(CreativeTabs.tabDecorations); } public GlowFlower(int par1, Material par2) { super(par1, par2); setBlockName("Glow Moss"); setStepSound(soundGrassFootstep); float var4 = 0.2F; setBlockBounds(0.5F - var4, 0.0F, 0.5F - var4, 0.5F + var4, var4 * 3.0F, 0.5F + var4); setCreativeTab(CreativeTabs.tabDecorations); } public void onBlockAdded(World world, int x, int y, int z) { if(theWorld == null) theWorld = world; world.scheduleBlockUpdate(x, y, z, blockID, 600); } public void updateTick(World world, int x, int y, int z, Random par5Random) { if(theWorld == null) theWorld = world; //make sure theWorld is not null getLightValue(null, x, y, z); //force recheck of light level, probably not needed world.scheduleBlockUpdate(x, y, z, blockID, 600); //schedule another update } @Override public int getLightValue(IBlockAccess world, int x, int y, int z) { if(theWorld != null) { int a = theWorld.calculateSkylightSubtracted(0); //force calculation of current lighting levels if(a > return 8; else return 0; } else return 8; //light level when the world is loaded (loading from save does not call onAdded, onPlaced, etc.) } public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) { return null; } public boolean isOpaqueCube() { return false; } public boolean renderAsNormalBlock() { return false; } public int getRenderType() { return 1; } It DOES light up at night and turn off during the day, but it's updates are once a minute (I didn't feel like burdening the system with frequent updates). And I had to make a class-level reference to the World in order to get the current sky light level.
  9. That's a shame. Oh well.
  10. It's just an integer, but it's one of those "conflicts with other dimension mods" if you try to use the same ID. Use a config value for it and pick a random 3-digit number* as your default (odds are you won't conflict, I think Mystcraft uses...12 and DivineRPG uses 7**). *I don't know what the maximum acceptable value is, fyi. But I'd be willing to bet that it's greater than 16. **For a while they were both on 7.
  11. Oh fancy. Still if that method isn't working for you, the redstone lamp way works
  12. Textures go in: /mcp/src/minecraft/mods/%MODNAME%/textures/%TYPE%/%FILENAME%.png Where %MODNAME% and %FILENAME% are specified in the call to iconRegister.registerIcon(...) e.g. for an item, iconRegister.registerIcon("MyMod:MyItem") will look for a texture at: /mcp/src/minecraft/mods/MyMod/textures/items/MyItem.png for a block, it will look in ...textures/blocks/ instead of ...textures/items/
  13. Unfortunately setLightValue is a class-wide...thing. If you open up BlockRedstoneLamp you'll see that it actually uses two block IDs to be lit or unlit: Block.java public static final Block redstoneLampIdle = (new BlockRedstoneLight(123, false)) public static final Block redstoneLampActive = (new BlockRedstoneLight(124, true)) BlockRedstoneLight.java public BlockRedstoneLight(int par1, boolean par2) { super(par1, 211, Material.redstoneLight); this.powered = par2; if (par2) { this.setLightValue(1.0F); ++this.blockIndexInTexture; } }
  14. OK, so I went looking at this. What is the farthest back a mod can be and still make use of the version independence? There's a guy going around on the Minecraft forums telling all the 1.4.7 mod owners to "reobfuscate with the latest reobfuscale_srg" and it'll magically update them to 1.5.1 But I can't seem to get it to work. I can't just add "--srgnames" to the end of the reobfuscate.bat file, I get an error: reobfuscate.py: error: no such option: --srgnames
  15. 1.5.1 likely changed something that causes your mod, betterrecipes.java at line 79 to no longer work correctly. Likely a function name changed.
  16. I was using another mod as a reference. The sloped blocks one, actually (the source is up on Github, IIRC).
  17. I've been having a similar issue. You're doing things a little differently than I am, but the solution will likely work for both of us. Whatever it is.
  18. What I mean is, I don't know why the coordinates of the block are relevant. I mean, we already did this: Block block = Block.blocksList[par1World.getBlockId(var38, var41, var44)]; So we're already looking at the block that we want to replace, why would we want that block's mine-ability to be based on...not itself?
  19. Oh, a vanilla class. *Peers at it* That looks like it should work. But only for the overworld WorldGenMinable's generate calls block.isGenMineableReplaceable which will only return true for smooth stone. Don't even ask me why it takes a world, x, y, and z parameters, it doesn't use them. No really: public boolean isGenMineableReplaceable(World world, int x, int y, int z) { return blockID == stone.blockID; }
  20. dropXpOnBlockBreak(...)
  21. What does WorldGenMinable do?
  22. Two things in this function: 1) you haven't asked the world for a biome 2) you're generating a random value from 0 to 64 (inclusive) with your randPosY. In order to generate from 50 to 65, you need to make that randPosY= Random.nextInt(15) + 55; In order to get the biomeID, you need... BiomeGenBase b = world.getBiomeGenForCoords(chunkX, chunkZ); if(b.biomeName.equals("Desert") || b.biomeName.equals("DesertHills")) { //existing code } If you want to make sure you only generate under sand, you'd have to check the block ID at the selected X,Y,Z coordinate: world.getBlockId(randX, randY, randZ) == Block.sand) Though you might want to check the block above rather than the exact x,y,z or you could check against sandstone instead.
  23. I think most people do the config and myBlock = new MyBlock(...) in the @preinit with the various registrations in init. At least, that's what I've seen and do.

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.