Skip 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. Take a look at what I did here https://github.com/Draco18s/Decaying-World/blob/master/draco18s/decay/blocks/HealthFence.java
  2. public boolean interact(EntityPlayer player)?
  3. What? Thats a thing...wow.. i feel dumb....ive never had that problem. Ill change them to well below that then i suppose then give it a shot. Thank you Item IDs are shifted by 255 to avoid conflicts with (originally) vanilla blocks.
  4. @Override { return false; } @Override public boolean renderAsNormalBlock() { return false; } People will still bump into it and you will still be able to highlight it with the reticule. If you want something that is truly not-there, take a look at this class: https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/block/BlockLight.java
  5. This is both really easy to do and really difficult, due to edge cases and weirdness the player can do if you're not careful. Namely if someone places this light block on top of another one. Here's some code I have that will steal the texture for the next not-this block in an orthogonal direction (that is, it looks for a not itself block in a direction until it hits air, if it finds air it tries another direction, if it fails it uses grass). Its not the greatest code, but it works. public Icon getBlockTexture(IBlockAccess world, int x, int y, int z, int side) { //int mymeta = world.getBlockMetadata(x, y, z); //if(mymeta == 0) { int[] id = {world.getBlockId(x, y-1, z),world.getBlockId(x-1, y, z),world.getBlockId(x+1, y, z),world.getBlockId(x, y, z-1),world.getBlockId(x, y, z+1),world.getBlockId(x, y+1, z)}; int[] meta = {world.getBlockMetadata(x, y-1, z),world.getBlockMetadata(x-1, y, z),world.getBlockMetadata(x+1, y, z),world.getBlockMetadata(x, y, z-1),world.getBlockMetadata(x, y, z+1),world.getBlockMetadata(x, y+1, z)}; //.get.getBlockTextureFromSideAndMetadata(par5, par1IBlockAccess.getBlockMetadata(par2, par3, par4)); for(int i = 0; i < id.length; i++) { Block block = Block.blocksList[id[i]]; if(block != null) { if(block != this && block.isOpaqueCube()) { Icon icon = block.getIcon(side, meta[i]); if(icon != null) { return icon; } } else if(block == this) { Icon icon = Block.grass.getBlockTextureFromSide(1); switch(i) { case 0: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y-1, z, side, 0); break; case 1: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x-1, y, z, side, 2); break; case 2: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x+1, y, z, side, 3); break; case 3: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z-1, side, 4); break; case 4: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z+1, side, 5); break; case 5: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y+1, z, side, 1); break; } if(icon != null && icon != Block.grass.getBlockTextureFromSide(1)) { return icon; } } } } return Block.grass.getBlockTextureFromSide(1); /*} else { return blockIcon; }*/ } public Icon getBlockTextureDirectional(IBlockAccess world, int x, int y, int z, int side, int direction) { int id = world.getBlockId(x, y, z); int meta = world.getBlockMetadata(x, y, z); Block block = Block.blocksList[id]; if(block != null) { if(block != this) { Icon icon = block.getIcon(side, meta); if(icon != null) { return icon; } } else { Icon icon = Block.grass.getBlockTextureFromSide(1); switch(direction) { case 0: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y-1, z, side, 0); break; case 1: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y+1, z, side, 1); break; case 2: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x-1, y, z, side, 2); break; case 3: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x+1, y, z, side, 3); break; case 4: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z-1, side, 4); break; case 5: icon = ((BlockIllusionary)block).getBlockTextureDirectional(world, x, y, z+1, side, 5); break; } return icon; } } return Block.grass.getBlockTextureFromSide(1); } The cast to BlockIllusionary will need to be replaced with a cast to your block type. (Bad intenting due to copy/paste from github, original here: https://github.com/Draco18s/Artifacts/blob/master/draco18s/artifacts/block/BlockIllusionary.java )
  6. Packets aren't that bad. There are some tutorials out there, and while it takes some getting used to, it's basically "write this data, now send the packet" and "oh I got a packet, lets read the data." It's always best practice to write an integer to your packets first, indicating how the packet handler should proceed from there (essentially a packet ID).
  7. What on earth. I doubt you know what you are doing. It means if a, b, c, d, e and f are equal... You can also do this and get the same result. if(a == b && a == c && a == d && a == e && a == f) if a == b and a == c, you don't need to then check b == c. It's called the transitive property of mathematics.
  8. [me=Draco18s]sees code and no crash, still doesn't know what kind of problem to look for.[/me]
  9. You'd need to set the metadata as well, as metadata 0 implies a source block.
  10. Well you could clone the mob's own bounding box and then use .expand() instead of creating a new AABB.
  11. Yeah, it was really annoying not being able to do anything with them outside the changing the radius. Feel free to use and modify that class however you need. It's pretty flexible already, but there's always room for improvement At the time I had been trying to make shaped explosions. But yeah. I might get back to it eventually, little too deep in other things right now.
  12. You should probably use a tab other than tabAllSearch, too.
  13. You mean like this.posX?
  14. It's probably not removed. Just not deobfuscated. In any case, I don't know the answer.
  15. I tried messing with explosions once too and never got anywhere. I'll have to bookmark that.
  16. [me=Draco18s]sees no code and no crash report[/me] [me=Draco18s]shrugs and leaves[/me]
  17. public String getItemDisplayName(ItemStack par1ItemStack) { } Just be sure to use an untranslated string and then translate it. eg. return StatCollector.translateToLocal("item.myItem.name");
  18. All in all: Bad all around.
  19. Yes. Delete the tile entity. You're not using a tile entity. At all. Anywhere. Get rid of it. Player inventory screen is not a tile entity.
  20. Yes. And that's why not. Oh man, that helps. I'll take another stab at it today. Yay! Man, that was obtuse; don't think I'd have ever figured that out on my own. Thanks.
  21. I want to render an item in a similar manner to the clock or compass, which uses an animated texture, but is not animated on a per-frame basis, but rather on other events (e.g. time, like the clock). The way vanilla does this is it uses a subclass of TextureAtlasSprite and inside that it manages the animation directly. However, there does not be a way to register a TextureAtlasSprite in such a way that actually WORKS. In theory, this should work: @ForgeSubscribe public void registerTextures(TextureStitchEvent.Pre event) { event.map.setTextureEntry("modid:calendar", new TextureCalendar("modid:calendar")); } But it doesn't, as you can only register sprites for objects that don't already have one registered, and by the time this event is called, there's already an entry in the Hashmap for that string (which is the same as the item's texturename*). "Wait," you say, "You're trying to load a texture entry before any entries have been registered (TextureStitchEvent.Pre) and you can't because there's already an entry!?" Yup. It happens to be blank, but it DOES exist in the hashmap. TextureAtlasSprite{name='modid:calendar', frameCount=0, rotated=false, x=0, y=0, height=0, width=0, u0=0.0, u1=0.0, v0=0.0, v1=0.0} The texture I'm using obviously doesn't have 0 frames and 0 height and width. But none the less that entry prevents me from registering my own TextureAtlasSprite. How the hell am I supposed to do this? *Using a different string doesn't work, as the item's texture string is used as a lookup in the hashmap. Changing the item's texture string later also doesn't work.
  22. Here's some working code that I use Property cw = config.get("WorldGen","dimensionWhitelistList", new int[] {0}); Property cb = config.get("WorldGen","dimensionBlacklistList", new int[] {-1,1}); int[] white = cw.getIntList(); int[] black = cb.getIntList(); Arrays.sort(white); Arrays.sort(black); String a=Arrays.toString(white); String whitestring[]=a.substring(1,a.length()-1).split(", "); String b=Arrays.toString(black); String blackstring[]=b.substring(1,b.length()-1).split(", "); cw.set(whitestring); cb.set(blackstring); It sorts two lists of dimensions so that they're in numerical order.
  23. 1) get passed a reference to it 2) DimensionManager.getWorld(id)

Important Information

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

Account

Navigation

Search

Search

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.