Everything posted by Draco18s
-
[1.7.10] Consume Logs
That function returns an ItemStack . It has a stackSize property. Use the decrement operator on it.
-
[1.7.2][Solved]Multiple potion effects on food
player.addPotionEffect(new PotionEffect(Potion.resistance.id, 1800, 10));//parameters: potion effect, duration, strength
-
[1.7.10] Consume Logs
player.getHeldItem() ? player.inventory.getStackInSlot(slotNum) ?
-
[1.7.10] Consume Logs
- [1.7.10] Consume Logs
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.- Grass Texture
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.- Forge server won't load
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.- Forge's Liquid ISBRH doesn't render backfaces
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?- Liquids, Gasses, Rendering, And Others?
I'll dig around in there.- Forge's Liquid ISBRH doesn't render backfaces
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.- Liquids, Gasses, Rendering, And Others?
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); }- Liquids, Gasses, Rendering, And Others?
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.- Custom Trees 1.7.2 Problem.
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"}};- Custom Trees 1.7.2 Problem.
Well, you didn't tell us what the error is so that makes it harder.- [1.8] [SOLVED] Trying to get the highest block at the location
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() )- [1.7.10] [Solved] Putting player inventory into my Gui?
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...- Grass Texture
That shortcut actually messes me up all the time- Grass Texture
It's amazing what Eclipse can do. Have you tried hovering your mouse over a class name? Do that and click the green dot.- Grass Texture
You need to look at BlockGrass and see how it gets a color and then copy that function. I think it's getColorMultiplier- How does i generate blocks on top of the surface world (like flowers)?
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; } }- [1.8] [SOLVED] Trying to get the highest block at the location
No, no you cannot. For two reasons. 1) @SideOnly(Side.CLIENT) 2) Returns horizon height for use in rendering the sky. As in, where the sun gets clipped: return this == FLAT ? 0.0D : 63.0D;- [1.7.10] Check If Birch Is In Hand?
And now you know why we use trace statements. They tell you what the program is doing as it does it, and lets you locate the problem area of code rather than BLINDLY GUESSING.- [1.7.10] Check If Birch Is In Hand?
Ok, now make your code look like this: System.out.println("Right clicked with: " + hand.getItem() + ":" + hand.getItemDamage()); System.out.println(hand.getItem() == Item.getItemFromBlock(Blocks.log)); System.out.println(hand.getItemDamage() == 0); System.out.println((hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0)); if(hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0) { System.out.println("Right clicked with the right block!");//this is the only new line And give me the output again.- [1.7.10] Check If Birch Is In Hand?
Just above that if statement, put this: System.out.println("Right clicked with: " + hand.getItem() + ":" + hand.getItemDamage()); System.out.println(hand.getItem() == Item.getItemFromBlock(Blocks.log)); System.out.println(hand.getItemDamage() == 0); System.out.println((hand.getItem() == Item.getItemFromBlock(Blocks.log) && hand.getItemDamage() == 0)); Then tell me what it prints out when you use various blocks.- [1.7.10] Check If Birch Is In Hand?
- [1.7.10] Consume Logs
IPS spam blocked by CleanTalk.
Important Information
By using this site, you agree to our Terms of Use.