Jump to content

DavidM

Members
  • Posts

    1830
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by DavidM

  1. 7 hours ago, CaptainDoge said:

    Just to be sure this

      Hide contents
    
    
        public static final Block GRASS_BLOCK = new GrassBlock(Block.Properties.create(Material.ORGANIC).tickRandomly().hardnessAndResistance(1.5F).sound(SoundType.PLANT)).setRegistryName("minecraft:grass_block");

     

    is what is meant by 

    either way didn't seem to make a difference

     

    I have removed the use of base classes, this \/ is what I have replaced it with I am not sure if this is correct but the items seem to behave properly

      Reveal hidden contents
    
    
                new BlockItem(STONE, new Item.Properties().group(ItemGroup.BUILDING_BLOCKS)).setRegistryName("minecraft:stone"),

     

    Despite all these changes I am still getting the same behavior, after some experimentation I have found that some world gen works properly

     

    World gen that works:

    Lakes-Lava and water above and under ground

    Mine shafts

    normal stone world gen

    all ores

    dirt, gravel, andesite, diorite, granite patches

     

    World gen that doesn't work:

    caves in stone 

    grass blocks

    sand

     

    Attached picture displays strange behavior 

    ToGrassOrNotToGrass.png

    (I can't seem to partially quote a post on mobile)

     

    That is not what I meant. You'll have to replace the constants in Blocks class via reflection.

  2. 4 minutes ago, Kiljaeden053 said:

    Can backdoors be prevented by simply not allowing assholes online to do the work on plugins for you that they can use to backdoor your server?

    Yes (that is the definition of backdoor - coders creating exploits in the code for their personal gain).

     

    4 minutes ago, Kiljaeden053 said:

    Or there is something else that can be used to backdoor using minecraft glitches that is unprevented/difficult to fix and your server becomes backdoored.

    In that case, the problem is not "backdoor", but rather "cheating/hacking" (depending on whether the situation happens in-game or on your server). There are anti-cheat plugins that you can use to prevent the former.

  3. 1. Don't use bases. They are an abuse of inheritance.

    2. Try replacing the constant values of items and block in Items and Blocks class respectively with your custom instances. I haven't met this exact problem before, but I guess it is caused by vanilla's still trying to use the original values from those two classes.

  4. You need to learn about the concept of sides.

    Input events are client side; you cannot do anything that would affect the server (interact with world, blocks, entities, etc).

    Instead, subscribe to PlayerTickEvent, and check if the event is fired on the server side and check PlayerEntity#isSneaking for sneaking.

  5. This is nostalgic... Reminded me of that time back in middle school where we were asked to make a chess game in Java as a class assignment.

     

    Back on topic. If you really want to reference the chess controller from every single chess piece, then I guess you could make a tile entity for each of them (or even make the chess pieces into entities, which is something I would do since you can create the animation of chess pieces sliding across the board). From that point on, just send all interactions on the chess pieces to the chess controller and let it handle the logic. Note that the chess piece should only store the BlockPos of the chess controller, and fetch the actual tile entity of it when it is actually needed.

     

    On a side note, I think that with the new way block properties are handled after the flattening, it is possible to store the chess controller's BlockPos as a property instead of creating a tile entity for it. Not sure if that is a good idea from the design perspective though.

  6. 9 hours ago, Melodia said:

    Is it possible or is there any variable to change the reach radius to be around my hand at a certain player height?

    That is changeable in the player's attribute. Obtain the attribute via LivingEntity#getAttribute and pass in the REACH_DISTANCE in PlayerEntity to obtain the reach attribute. You can modify that to change block reach distance.

    Unfortunately I don't think there is a convenient method of changing the reach for entity interactions. You'll have to do some manual ray casting.

    • Like 1
  7. 1. You need to use ObfuscationReflectionHelper (can’t remember the exact spelling).

    2. Reflection is expensive. Use it once and store the result in a static field and use that from now on.

    3. You should directly reference PlayerEntity.class instead of using getClass.

    • Like 1
  8. Oh I'm just being lazy there.

    Instead of finding the registry reference during the appropriate time, I used a LazyValue to find it via GameRegistry.findRegistry the first time I call it.

    It is functionally the same with:

    if (registry == null) {
    	registry = findRegistry();
    }
    
    doStuffWithRegistry();

     

  9. 5 hours ago, Melodia said:

    I don't really understand how would I encode/decode something that isn't primitive >.<

    There are helper functions that allows you to encode complex data (such as ITextComponent and BlockPos) to NBT.

     

    5 hours ago, Melodia said:

    I'm trying to sync the capabilities, is making a list of all the capabilities a good start?

    I personally store my capabilities in static fields marked with @CapabilityInject annotation so that the value of the capability is injected at runtime. An example is this.

     

    Here are some links to the capability part of my test mod if you need:

    My capability object.

    My capability provider.

    My capability storage.

    My event subscriber for attaching capabilities to player.

    My packet that syncs the data of capability to the client.

  10. Quote

    event.getRegistry().register(new ArmorItem(ModItemTier.ModArmorMaterial.TEST, EquipmentSlotType.LEGS,

                    new Item.Properties().group(RareMetalsRevised.TAB)).effect.(new EffectInstance(Effects.ABSORPTION,600, 5)).setRegistryName("rhodium_leggings"));

    That is not valid Java. Please learn Java before making a mod.

    I would also suggest to get more familiar with your IDE so that you can understand its warnings and errors.

  11. If something actually affects the game (like changes to the world, as well as inventory), then it should be done on the server.

    Think to yourself "if the player can freely edit this value/call this function, would that affect other players as well as bring an unfair advantage/disadvantage?" If yes, then throw it on the server.

×
×
  • Create New...

Important Information

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