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. Also might want to take a look at this: https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/entity/EntitySpecialArrow.java The class is coded to accept all kinds of special effects, though I only needed two: knockback and explosions. Look at hitEffect(Entity entityHit) Also, I think its set up to "always inflict damage" (ignores hurtResistanceTime ) which was based off of having a "shotgun" effect working properly. Because it extends EntityArrow, I never set up a special renderer.
  2. Whoops. For some reason ctrl-f failed for me. Foxing Firefox Nightly, all the shit is broken. Lets see... Edit: I am not seeing anything out of place. Start adding log messages to figure out what object isn't doing what you expect it to.
  3. Well, you're not calling juiceItem() anywhere. That might be a good place to start.
  4. That function returns an ItemStack . It has a stackSize property. Use the decrement operator on it.
  5. player.addPotionEffect(new PotionEffect(Potion.resistance.id, 1800, 10));//parameters: potion effect, duration, strength
  6. player.getHeldItem() ? player.inventory.getStackInSlot(slotNum) ?
  7. Unfortunately that function doesn't deal with metadata. You're better of checking the player's hand for spruce (item == Blocks.log && itemDamage == 4 (I think spruce is 4)), and if so, decrementing the stack size.
  8. All you have to do is return the decimal value that has the color hex you want the color to be. You're trying to mimic grass, so look at what BlockGrass does. Copy it, paste it.
  9. Client-side-only does not mean you can't use it, it means that it does not install on the server, at all, ever. Client side only means CLIENT SIDE ONLY.
  10. I'll look into doing a pull request, but I'm not all that good with the tessallator either. Though, why do I have to wait for 1.8 to make the request?
  11. I'll dig around in there.
  12. We creating a custom fluid, if the player is inside this fluid, the quads facing the player should render and they currently do not. Compare using the vanilla renderer and the Forge renderer: http://s14.postimg.org/v508hbp0x/2014_12_04_15_15_59.png[/img] http://s14.postimg.org/45wdm62k1/2014_12_04_15_15_00.png[/img] This is on Forge 1240, latest 1.7.10 release.
  13. Has its own problem, of not showing the "you are underwater" overlay. Also, apparently the forge renderer doesn't render backfaces. WTF. Nope, because of how air is handled. if (this.isEntityAlive() && this.isInsideOfMaterial(Material.water)) { if (!this.canBreatheUnderwater() && !this.isPotionActive(Potion.waterBreathing.id) && !flag) { this.setAir(this.decreaseAirSupply(this.getAir())); //snipped } } else { this.setAir(300); }
  14. Alright, so I've create a custom liquid. All is fine and dandy except for a few things: Material.water has a lot of side effects, as does Material.lava. None of these side effects are controllable and I want to not-have some of them and have others. Using water means that entities can swim "up" in it (and I'd like my custom 'liquid' to be a gas and not have that property). It also causes the player to drown (and I do want that) and any material other than water resets the air meter. For lava, this sets the player on fire and I don't want that. Not using Material.water (or lava) and still letting vanilla code handling (render id 4) rendering causes it to crash, due to getFlowDirection being a static method inf BlockLiquid that checks for only water and lava materials. Not using Material.water and letting the Forge renderer take over causes there to not be a "you are underwater" overlay and turn fog on, likely because it's handled by vanilla. Anyone have solutions to this problem? Registering an ISBRH and doing the rendering myself is fine, but I'd still like to cause the drowning effect.
  15. for(int j = 0; j < leaftypes[i].length; ++j) public static final String[][] leaftypes = new String[][] {{"leaf_TyreOpaque"},{"leaf_Tyre"}}; Your array of leaftypes is a [2][1] length array. Of course array index [x][1] will be out of range. Try public static final String[][] leaftypes = new String[][] {{"leaf_TyreOpaque","leaf_Tyre"}};
  16. Well, you didn't tell us what the error is so that makes it harder.
  17. That function is basically just a for loop iterating over the column anyway. Here's 1.7.10's version: /** * Finds the highest block on the x, z coordinate that is solid and returns its y coord. Args x, z */ public int getTopSolidOrLiquidBlock(int p_72825_1_, int p_72825_2_) { Chunk chunk = this.getChunkFromBlockCoords(p_72825_1_, p_72825_2_); int x = p_72825_1_; int z = p_72825_2_; int k = chunk.getTopFilledSegment() + 15; p_72825_1_ &= 15; for (p_72825_2_ &= 15; k > 0; --k) { Block block = chunk.getBlock(p_72825_1_, k, p_72825_2_); if (block.getMaterial().blocksMovement() && block.getMaterial() != Material.leaves && !block.isFoliage(this, x, k, z)) { return k + 1; } } return -1; } So there's little harm in duplicating it and just looking for the block you do care about. That function "cheats" a little by finding the top-most y-chunk first ( chunk.getTopFilledSegment() ), but for something that happens less than once-per-chunk (you're spawning bushes, they should be pretty rare, on the order of once every 25 chunks or less) the performance impact is going to be pretty minimal. Heck, even once-a-chunk isn't going to create noticeable world gen delay trying to locate the world surface. You can be reasonably assured that it's "at least Y=60" for the overworld for instance.... (Although you'd be better off using worldObj.provider.getAverageGroundLevel() than a fixed value; note that even though it says "average height" it's more like "minimum ground height before the ocean kicks in" as it calls terrainType.getMinimumSpawnHeight() )
  18. https://github.com/Draco18s/Artifacts/blob/master/main/java/com/draco18s/artifacts/inventory/ContainerPedestal.java Even still has the comments from when I copied it from a tutorial...
  19. That shortcut actually messes me up all the time
  20. It's amazing what Eclipse can do. Have you tried hovering your mouse over a class name? Do that and click the green dot.
  21. You need to look at BlockGrass and see how it gets a color and then copy that function. I think it's getColorMultiplier
  22. Using the ore generator is not the best method here. You're better off picking an X and Z location inside a chunk and then finding the surface block and populating that way. I use this function, which has a few extra bits, but does what you need. /*Places a random collection of blocks (flowers) at a random distance from a given spot on the surface * Paramters: * x/y/z - location on the surface * block and meta * radius is the maximum distance away to spawn at * num is how many blocks to attempt to place * cluster radius is how close (or far) the blocks will be placed */ public static void scatterFlowers(World world, int x, int y, int z, Block b, int meta, int radius, int num, int clusterRadius) { Random r = new Random(); float[] u = RandomInUnitCircle(r); //find a location inside a unit circle, this value is multiplied by the radius. int fails = 0; int j, k, l; while(num > 0 && fails < 20) { j = x + r.nextInt(clusterRadius) - (clusterRadius/2) + Math.round(u[0]*radius); //random point inside the cluster radius, plus the offset for the large circle k = y-5; //check up and down a few blocks l = z + r.nextInt(clusterRadius) - (clusterRadius/2) + Math.round(u[1]*radius); //random point inside the cluster radius, plus the offset for the large circle for(int f=0; f+k <= y+5; f++) { if(world.getBlock(j, f+k, l) == Blocks.grass && (world.getBlock(j, f+k+1, l) == Blocks.air || world.getBlock(j, f+k+1, l) == Blocks.tallgrass)) { //place above grass and replace tall grass world.setBlock(j, f+k+1, l, b, meta, 3); --num; k = 100; } } ++fails; } } public static float[] RandomInUnitCircle(Random rn) { float t = (float)Math.PI * (2*rn.nextFloat()); float u = rn.nextFloat()+rn.nextFloat(); float r = (u>1)?2-u:u; return new float[] {r*(float)Math.cos(t), r*(float)Math.sin(t)}; } I call this function after I've found a point on the surface, e.g.: //from an X/Y/Z location, go up until we find the surface for(int j=1; y+j < 90; j++) { if(world.getBlock(x, y+j, z) == Blocks.grass) { MainMod.scatterFlowers(world, x, y+j+1, z, OresBase.blockOreFlowers, 0, 25, 8, 11); return; } }

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.