Jump to content

izako

Members
  • Posts

    35
  • Joined

  • Last visited

Posts posted by izako

  1. 1 hour ago, diesieben07 said:

    Yes, the chunk coordinates you generate would be a fixed reference point on your structure, e.g. the north-west-most chunk of the structure.

    If you then get a request to generate a specific chunk you can work out which part of your structure you need to generate (if any) from the position of the north-west-most chunk (generated by the seeded Random) and the chunk being generated.

    and how would i save that chunkPos so that it only ever spawns once(even when reloading the game)
    sorry for the questions im really confused

  2. 1 hour ago, diesieben07 said:

    Yes, the chunk coordinates you generate would be a fixed reference point on your structure, e.g. the north-west-most chunk of the structure.

    If you then get a request to generate a specific chunk you can work out which part of your structure you need to generate (if any) from the position of the north-west-most chunk (generated by the seeded Random) and the chunk being generated.

    how would i get a random chunkpos from the world seed?

  3. 1 minute ago, diesieben07 said:

    Using WorldSavedData or similar mechanisms isn't ideal because it means the world is no longer 100% dependent on the Seed (where your structure ends up being depends on in which order the chunks are generated).

     

    The way I'd do it is derive another Random instance from the World seed and use that to generate the two chunk coordinates (x and z) of the chunk you want to be in. Then only generate in that chunk.

    but my structure's size is several chunks, is your method still valid?

  4. So after alot of messing around and trying random stuff I was able to get my structure to work. my problem is that i want the structure to only spawn once per world. I did that in 1.12.2 by using worldsaveddata but i cant do that here because the generate structure methods runs in every chunk and not for the whole structure. I tried looking at how the stronghold does it but i didn't really understand it. basically my question is how can I limit my structure spawning to x amount of times.

     

     

    if you need it: 

     

  5. 1 hour ago, VirtCraft said:

    I had the exact same problem in 1.15.

     

    My Problem was, that the entity was not synced with the client correctly.

    My Solution was to override the

    
    ThrowableEntity#createSpawnPacket

    method in the Entity class, and call

    
    return NetworkHooks.getEntitySpawningPacket(this);

     inside that method.

     

    Maybe that helps.

    Yeah I tested it and it seems that the entity doesn't spawn on client. Even after doing what you said and I also added a customClientFactory but it's still null on client side

  6. 12 hours ago, TheGreyGhost said:

    Hi Izako

     

    Yes you're right, it will stop the game every tick.  But that doesn't matter because once it is stopped (paused) you can easily find the problem and solve it.

     

    If you're not used to the debugger I think it would be very helpful for you to spend some time learning how to use breakpoints, variable watches, and tracing in your debugger.  It makes debugging much much easier and it will make your programming experience very frustrating if you don't use it.  There are many many great online tutorials, and it really isn't difficult to learn the basics.

     

    Cheers

      TGG

    It seems that the entity itself is never present. I checked the loop and the projectile entity never appears. It can't be the registration of the entity since i can summon the entity. 

  7. 5 hours ago, TheGreyGhost said:

    Howdy

    I suggest you could troubleshoot it by putting a breakpoint in WorldRenderer::updateCameraAndRender() at the 

    
    iprofiler.endStartSection("entities");

    section, then stepping through the entity loop until it reaches your entity and then tracing in to see where the problem is, eg

    1) Is your entity present at all?

    2) Is it being clipped (out of view)?

    3) Is the correct renderer being called?

    4) Is the renderer actually drawing anything?

     

    etc

     

    Cheers

      TGG

     

    if i put a breakpoint there it'll stop the game every tick so I can't really debug that way and I'm not quite sure what to do since I'm not used to the debugger.

  8. So, I've dealt with this error before back in 1.12.2 where the projectile would shoot and hit the entity but it'd be invisible. the fix i used in 1.12.2 doesn't seem to be the problem this time.

    I'm trying to make a custom projectile that shoots and im  using a custom renderer but the doRender method never actually runs.

     

    this is my item class: 

    https://github.com/izako666/HunterX/blob/1.14.4/main/java/com/izako/hunterx/items/YoyoItem.java

    this is my entity class: 

    https://github.com/izako666/HunterX/blob/1.14.4/main/java/com/izako/hunterx/items/entities/YoyoEntity.java

    this is my render class: 

    https://github.com/izako666/HunterX/blob/1.14.4/main/java/com/izako/hunterx/items/renderers/YoyoRenderer.java

    this is where i register my renderer: 

    https://github.com/izako666/HunterX/blob/1.14.4/main/java/com/izako/hunterx/registerers/ClientSideRegistry.java

    and that method gets called here: 

    https://github.com/izako666/HunterX/blob/1.14.4/main/java/com/izako/hunterx/Main.java

    here i register my entity: 

    https://github.com/izako666/HunterX/blob/1.14.4/main/java/com/izako/hunterx/registerers/ModEventSubscriber.java

     

    I used the debugger and all registry code does run, i also checked doRender in the renderer class but doRender didn't work

  9. 30 minutes ago, diesieben07 said:
    • The ID for your WorldSavedData must be a valid file name, it can't include a ":".
    • Your readFromNBT method does nothing but waste CPU cycles. You read the data from NBT and then... drop it on the ground and do nothing with it.
    • I doubt you want this.
    • I doubt you own this domain.

    I tried your fixes, sadly still doesn't work and the dat file still doesn't exist 
    updated data class
    https://pastebin.com/7JeYbuNn

  10. 1 hour ago, diesieben07 said:

    How would it not reset? It's just a field in a class. When you create an instance of the class it will be set to the initial value: 0. I am not sure what this is trying to achieve, but you cannot share data like this. Your event class exists once there is one value for these fields for all players.

    i have reset the value to get the capability of the player which is initially 0, would that work? I haven't tried it online yet

  11. 1 hour ago, Meldexun said:

    The healthStatCap variable in your HealthStat event is always 0 at the beginning. When your event gets called the first time it sets the value of healthStat from your capability to healthStatCap + 1 (0 + 1 = 1).

    I didn't think that would make it reset, its weird I didn't think of that tbh but thanks it works now

  12. So I'm trying to add stats to my mod using a mixture of capabilities to save the values and events to set attribute modifiers, but I'm having this universal problem with all my stats where when i exit out the game and re enter the capability value gets reset.
    https://github.com/izako666/HunterX_Public_2/blob/master/main/java/com/izako/HunterX/stats/events/HealthStatEvent.java
    this is one of the events that i use for stats ^

    in it the value healthStatCap gets reset when i exit mc and re enter, I think it has something to do with my capabilities so im going to put my capability code here too >
    https://github.com/izako666/HunterX_Public_2/tree/master/main/java/com/izako/HunterX/stats/capabilities

    here is  the capability interface, capability implementation, the provider, and the IStorage class

     

  13. On 6/12/2019 at 7:05 PM, Draco18s said:

    1) You have fields that you can't have (what happens when there's more than 1 player?) You shouldn't need either of these variables anyway. If the sword exists, it must be in the active hand to be removed (if the sword exists at all, and can be removed, then its been spawend). If the player moves the sword to a different slot then itemArea will be wrong.

    2) RightClickEmpty already runs when the active hand slot is empty, so why are you checking to see if the active hand slot is empty?

    3) And of course, if there's a sword in that slot, the event won't fire because you right clicked while not empty

    4) Your code style is awful, please put the two if statements on line 38 on different lines and correctly indent things.

    5) Don't check chest.getItem().equals(ModItems.HANZOS_CHESTPLATE) && playerIn.isSneaking() twice. Put those in the outer if statement.

    thanks, None of that would really fix my major problem but those are things i should've fixed either way, in the end i figured out the problem and im currently fixing it.
     

  14. alright so I'm trying to make an event that basically "if conditions are met spawn sword in hand and if conditions are met for other if statement remove sword" but thing is when i tried the event it seemed to run both if statements at almost the same time making my sword invisible upon spawning it i basically had to throw the sword out of my inventory to see it then i tried checking if the world wasn't remote for it to work but when i do "if(!world.isRemote)" it basically completely stops working. no code is run. 
    My event class.

    https://pastebin.com/Rr24Nj2g

  15. 2 hours ago, DavidM said:

    That is suppose to happen; the @Override annotation should give a compile-time error when the method associated with it does not override a super method.

    Make sure the return type and parameters of your onArmorTickUpdate matches the return type and parameters of the onArmorTickUpdate method in the class you are overriding.

     

    If you still cannot understand what you are suppose to do, the I'm afraid you might not be ready to make Minecraft mods. You should have basic Java knowledge, which includes overriding and inheritance, before attempting to make a mod. I would recommend looking up some Java tutorials in order to get familiar with Java before making mods.

    thanks it worked i was just using the wrong method it was actually onArmorTick not onArmorTickUpdate

  16. 6 minutes ago, DavidM said:

    You still did not annotate your onArmorTickUpdate method with the @Override annotation.

    that just gave me the error "The method onArmorTickUpdate(World, EntityPlayer, ItemStack, EnumHand) of type HanzoArmorBase must override or implement a supertype method"

     

  17. 32 minutes ago, DavidM said:

    1.

    Do not create "base" classes (ItemBase, BlockBase, etc). Do not abuse inheritance to write less code.

      

     2. Remember to check the side by using World#isRemote.

      

    3.

    Are you sure you want to use a while loop there?

     (Hint: no)

     

    4. Annotates your methods that are meant to override methods from the parent class with the @Override annotation (onArmorTickUpdate in this case).

     This is leading to your current problem, as the method signature of your onArmorTickUpdate method does not match that of its super method.

    i did everything you said and i made it extend ItemArmor instead and added all missing code but it still doesn't seem to work at all it gives no mention of what i asked of it 

     

    *id post a pastebin but its not allowed in my country and my vpn isn't working currently*

     

    HanzoArmorBase.txt

  18. So I'm trying to make a custom chestplate that spawns a sword when you sneak and right click but before i even reach the part about the summoning sword I want to make sure that its actually checking if im wearing it and if that's working So my current two problems are:
    it won't do the command I'm asking it to do so i could make sure it actually works
    I can't seem to find a way to make it so it would do it when i right click it i know onItemRightClick but that's "onItem".

     

    package com.izako.HunterX.items.armor;
    
    import com.izako.HunterX.init.ModItems;
    
    import net.minecraft.client.Minecraft;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.inventory.EntityEquipmentSlot;
    import net.minecraft.item.ItemStack;
    import net.minecraft.util.EnumHand;
    import net.minecraft.util.text.TextComponentString;
    import net.minecraft.world.World;
    
    public class HanzoArmorBase extends ArmorBaseSkin {
    
    	public HanzoArmorBase(String name, String pathName, ArmorMaterial material, int renderIndex,
    			EntityEquipmentSlot equipmentSlot) {
    		super(name, pathName, material, renderIndex, equipmentSlot);
    	}
    
    	public void onArmorTickUpdate(World world, EntityPlayer playerIn, ItemStack itemStack, EnumHand handIn) {
    			while (playerIn.isSneaking()) {
    
    				playerIn.setHealth(playerIn.getHealth() - 1);
    				playerIn.sendMessage(new TextComponentString("woah there fella"));
    			}
    
    		}
    
    	}
    

     

×
×
  • Create New...

Important Information

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