Jump to content

Alpvax

Members
  • Posts

    304
  • Joined

  • Last visited

  • Days Won

    3

Posts posted by Alpvax

  1. Are you calling this on the server side? (Use world.isRemote to check, it will be false on the server).

    Where are your i, j, and k variables coming from? You should probably only create the BlockState BlockPos once. And you can use BlockState BlockPos.up (or something similar) to get the BlockPos above.

     

    You should post your full structure code (or even better a link to a git repository).

  2. 9 hours ago, Choonster said:

    You're checking if the Block is both replaceable and is equal to Blocks.GRASS, which will never be true because Blocks.GRASS isn't replaceable.

     

    You can use the && (and) operator to combine multiple boolean expressions (like the conditions of the four if statements) into one.

     

    37 minutes ago, funsize888 said:
    
    		if(world.getBlockState(new BlockPos(i,j+1,k)).getBlock().isReplaceable(world, new BlockPos(i,j+1,k))) {
    		if(world.getBlockState(new BlockPos(i,j,k)).getBlock() == Blocks.GRASS) {

    I have this and its still not working

    Are you trying to replace the block above the grass or the grass itself?

    You are now saying " if the block above is replaceable and the block is grass, do the following:"

  3. What is the API? How does the API say you should use it?

     

    Looks like you need to include the API before decompiling MC, that is a srg name, not the deobfuscated name that your IDE will display it as. Hence being unable to find it.

    Looks to me like Minecraft::getMinecraft or ::getInstance or something along those lines, but you should set up your workspace with the API correctly.

  4. 1 hour ago, Draconwolver said:

    Thanks, I got it working by simply returning in the RenderEntityItem::doRender method that I overrode. However, what if I wanted to only hide specific kinds of EntityItems? If I copy the whole code for the RenderEntityItem::doRender method and paste it in my method override, there are some private fields that I do not have access to. Should I copy those in my class, too?

     

    EDIT: I was able to cancel the rendering of only one kind of item (e.g., diamonds) by copying and pasting like I explained above. Continuing with the additional complexity theme, is there a way to make this rendering toggleable through a KeyBinding or whatnot, or is this way of rendering permanent once the game loads?

    Try using inheritance. Check for your item, if you want to render it, call super.doRender. If you want to not render it, just return.

    • Like 1
  5. On 2017-5-2 at 11:53 PM, Sawii00 said:

    perfect, I'll try that too. For now this method works because I have just one Item I want to check, but Is there a way to add the pan (or any other item that goes in that single slot) inside a recipe? I that case I would not have to check for the content of the slot but I would just check the whole recipe. I will have probably to change the addRecipe method so that I can consider that extra slot.

    One option would be to add that slot to your recipe implementation.

    An alternative would be to add a wrapper around your recipe that checks the item in the slot, then passes off the matching to the wrapped recipe. That way you can take full advantage of any normal crafting recipe (shaped, shapeless, oredictionary, custom).

  6. 12 hours ago, ctbe said:

    I fixed it by creating a method in my item's class that sets the creative tab and manually calling said method at preInit, when I know for sure the creative tab for my mod will already exist.

    Why? There is already a method to set the creative tab, just call that in preInit

  7. What about supporting other entities? Would it be better to use the join world event?

     

    EDIT: Clearly wasn't thinking straight, most people wouldn't try to send packets to the client who has connected as a creeper!

  8. I have a system which reads acquired perks from NBT, then sets the perk level accordingly. Setting the perk level could add abilities, and adding abilities sends a packet to the client to add them client-side.

     

    What would be the best way of implementing this?

×
×
  • Create New...

Important Information

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