Jump to content

Draco18s

Members
  • Posts

    16559
  • Joined

  • Last visited

  • Days Won

    155

Posts posted by Draco18s

  1. Yes-ish but also no-ish.

    Basically you can only have one "root" advancement (consider it the advancement that unlocks the tab itself), but there are some things you can do to make that advancement invisible.

    While I'm pretty sure the node graph is laid out programmatically now, you can still use Reflection to manipulate the placement (and so on) of the displayed UI (I did something similar in the past to create an achievement with two prerequisites that were themselves unrelated).

    Old, old code, but you can see that I used reflection to grab the display column and row fields and then set them to specific values for some advancements (mostly vanilla ones to shove them aside for my own). The fakeIronBar advancement sits behind the vanilla iron bar advancement so it looks like there's two arrows pointing at the same thing, but in reality there's only one pre-req per icon.

    https://github.com/Draco18s/HarderStuff/blob/master/src/main/java/com/draco18s/ores/util/StatsAchievements.java

  2. 18 minutes ago, Alpvax said:

    As for your actual request, you need to loop through all blocks above the player position (player y to world height), and check that they are air.

    There are some helper methods in the Level class that already do this for you. I don't know what the mojang names are, but canLightningStrikeHere and getGroundHeight are the mcp names

    • Like 1
  3. 3 hours ago, 1HA said:

    By the way, what do you mean "bolded" statement?

    I bolded a section in the quote of your previous post.

     

    3 hours ago, 1HA said:

    Error: Cannot resolve method 'of(<method reference>, net.hawon.spacesim.common.block.CopperCableBlock)'

    -> from "BlockEntityInit.java" : 27

    Maybe I think this error is triggered because something's missing. I think I can fix this.

    Your CopperCableBlockEntity doesn't have a constructor that matches the parameters being passed.

    Compare:

    With:

    I'm a bit less familiar with 1.17 and newer and how the various lambda stuff is defined, but I can compare the other block entities you have that do work with the one that doesn't: Your other two subclass and only have 2 parameters in their constructor, and generate the third for super.

  4. On 2/10/2022 at 6:35 AM, 1HA said:

    the machine(which receives the energy and consumes) tracks the connected cable. If it's connected to the generator which has energy stored, this machine works.

    How do you plan on determining whether or not the bolded statement is true?
    (by the way, the way IC2 works is that generators "push" power into cables and cables push that power into all connected adjacent blocks that accept power).

  5. Ok, so, this is really quite simple.

    The client is a lying, cheating, bastard. Do nothing on the client that the server needs to know about. Only send user input actions (not results) to the server. The server controls all.

    Block states are automatically communicated to the client when they change (unless the update flag says not to).

    As for why there are two entities:
    The same reason you have two java processes. One on the server (the server controls all) and one on the client (for how else would it be rendered?).

  6. 5 minutes ago, lGuestll666l said:

    if(Minecraft.getInstance()

    You can't do this. You want the blockstate of a block in the world, use the world given to you in the event. You want the player? Use the player given to you in the event.

     

    This code will crash dedicated servers.

    Quote

    its works fine but Block dont want to be placed, it turn in air for milisecond and turn to pumpkin back. 

    Yeah, because the server says "the fuck you doing client, that position is a pumpkin."

    • Like 1
  7. I meant that you don't want your code leap frogging from "tree" to "tree" when they're close enough together.

    Brich forest is probably fine, but the dark oak forest might be worth a test to make sure it doesn't take out the whole forest (ignoring item durability if you abort when it breaks).

  8. 3 hours ago, NJSwede said:

    but since trees and ore veins are relatively small, it's fast enough

    He says before finding a birch forest.

     

    3 hours ago, NJSwede said:

    The only thing I wonder if there's a more efficient way of digging out the "persistent" property.

    https://gist.github.com/prydin/cc48a3ddd645bcd6f73d63bac6aa75b7#file-featuredetector-java-L94-L97

    You should be able to do an instance-of check against the LeafBlock class.  Also note that other mods may not use "xxx_leaves" for their leaves, but might do "yyyleaves" or "zzzleafblock"

    As for the property:
    https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/EventHandlers.java#L39

  9. The best description of a "tree" is "a wood block above a dirt block with more wood blocks on top with leaves nearby." With the leaves being in at least one of the 17 other positions around the top-most log in the stack (also those positions might have more logs, and if you find one, keep checking in the adjacent new 25 for more logs in order to detect big trees).

    Knowing "these leaves are part of a tree" doesn't help identify if the player "chopped down the whole tree."

  10. You should absolutely call ForgeHooks.canHarvestBlock(state, entityPlayer, world, pos) before attempting to do anything to a block. If the return is false, skip that block.

    As for the proper way to dig it out, dig around in the vanilla blocks class and look for where ForgeHooks.modifyLoot is called. Once you find that spot you might have to go up the call stack a little bit before you find the exact thing to call, and if might be several things. Been a while since I looked at it.

  11. 10 hours ago, Luis_ST said:

    You can't

    What. Yes you can. GLM run after all vanilla logic.

    10 hours ago, Luis_ST said:

    You can't the json file is required 

    ...no, the two things are unrelated.

     

    11 hours ago, X_ZombieSlayer_X said:

    Is there anyway to use ILootCondition? The docs reference it, but don't have anything on it. Could I use ILootCondition instead of a lootmodifier json?

    ILootConditions are things that need to be true for loot things to happen. They're conditions, not loot tables or modifiers.

    And no, you must use a loot modifier to modify loot.

    In theory you could create a fortune-like enchantment and its own ILootCondition and then overwrite every single loot table from every single mod to add your special condition block, but that seems like a lot more work to me. And a lot less compatible.

    Quote

    If fortune uses a loot table

    It doesn't. Also, what if someone else does the same thing you're doing, but different?

    Use GLM.

×
×
  • Create New...

Important Information

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