Jump to content

poopoodice

Members
  • Posts

    1160
  • Joined

  • Days Won

    7

Everything posted by poopoodice

  1. There is, check vanilla for examples.
  2. No, that means you need to create anothet constructor that has no argument.
  3. Maybe it is not the best idea but what I do is apply 1 tick duration effect to the wearer if the wearer does not have the effect(isPotionActive) and has full equipped your armour set. By this you don't have to worry about the effect gets removed externally(milk, commands...), and the effect will disappear right after you take of your armour set. It also avoids you to remove the effect if the effect is applied externally via commands, potions...etc. Just my thoughts, may not be the best.
  4. https://stackoverflow.com/a/4186354 https://mcforge.readthedocs.io/en/latest/concepts/sides/#fmlenvironmentdist-and-onlyin I'm not sure which one is better (getPrivateValue/findField), but you will need to save the returned value into a static final field, and use them when needed. I hope you've done your own research and stuff instead of sitting here waiting for someone to give you copy paste code, good luck : )
  5. I don't think applying potion effects on client will work as you expected.
  6. CreeperEntity creeper = (CreeperEntity) event.getEntity(); if (event.getEntity() instanceof CreeperEntity) Why would you cast it before checking it? This makes the checking pointless. @Mod.EventBusSubscriber(value = Dist.CLIENT) You should not be modifying entity data on client.
  7. Code, better as a repo.
  8. Show all your code, it seems like you have duplicated item/block id or something like that.
  9. Check ForgeIngameGui, most of UI rendering are done there.
  10. It is a class, and that's not how it works. Store the field you got in a static final variable, then access it when needed.
  11. That's because you set it to 0. Use getMotion to get the entity’s motion.
  12. You can see how vanilla set blocks' render type in RenderTypeLookup
  13. Imo instead of sending stacks, you should probably send the slot numbers and let the server check then modify them.
  14. Make sure you check the element type of the event
  15. It does have the 1.16.3 version: https://www.curseforge.com/minecraft/mc-mods/a-v-a-in-minecraft/files/3054416 Thanks for the suggestions and ping diesieben07 : )
  16. For example LiteralArgumentBuilder<CommandSource> command = Commands.literal("test"); for(int i=2;i<5;i++) command.then(Commands.literal(Direction.byIndex(i).getString()));
  17. builder.then(Commands.literal(direction)) where ArgumentBuilder is an instance of ArgumentBuilder, and direction is the argument you want to add to the command, which can be achieved using for loops
  18. https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html LazyOptional.of(() -> new TestCapability()) or use :: LazyOptional.of(TestCapability::new)
  19. I'm pretty sure you are interacting directly with the player inventory https://github.com/Novarch129/JoJo-s-Bizarre-Survival/blob/1.15.x/src/main/java/io/github/novarch129/jojomod/capability/StandPlayerEffects.java#L26 Instead you should copy the inventory of the player in order to save it, for example ArrayList<ItemStack>, and use ItemStack.copy
  20. What I can think of is to use ItemStack.write() to write the stack into the compound, and then use CompoundNBT.put() to save the compound that contains the info of the itemstack. In this way every single compound will have an itemstack, store in that given compound. This is what I do to save a list of BlockPos private void writeBlockPosWithDirectionList(CompoundNBT compound, String key, HashSet<Connection> targetList, boolean direction) { CompoundNBT subCompound = new CompoundNBT(); ArrayList<Integer> x = new ArrayList<>(); ArrayList<Integer> y = new ArrayList<>(); ArrayList<Integer> z = new ArrayList<>(); ArrayList<Integer> d = new ArrayList<>(); targetList.forEach((connection) -> { BlockPos blockPos = connection.blockPos; x.add(blockPos.getX()); y.add(blockPos.getY()); z.add(blockPos.getZ()); if (direction) d.add(connection.direction.getIndex()); }); subCompound.putIntArray("x", x); subCompound.putIntArray("y", y); subCompound.putIntArray("z", z); if (direction) subCompound.putIntArray("d", d); compound.put(key, subCompound); } read private HashSet<Connection> readBlockPosWithDirectionList(CompoundNBT compound, String key) { HashSet<Connection> connections = new HashSet<>(); CompoundNBT subCompound = compound.getCompound(key); int[] x = subCompound.getIntArray("x"); int[] y = subCompound.getIntArray("y"); int[] z = subCompound.getIntArray("z"); int[] d = subCompound.getIntArray("d"); for (int i=0;i<subCompound.getIntArray("x").length;i++) connections.add(new Connection(new BlockPos(x[i], y[i], z[i]), Direction.byIndex(d[i]))); return connections; }
  21. I've made a pr a few days ago, but I was dumb that I made the changes directly to the 1.16.x branch of the forked repository, and that means if I want to make another pr which is on another branch I've specifically created, it will have the files changed and the commits of other contents. Since I can't really create two forks, the only way I can think of is cancel the pr, re-setup my fork and local repo, and create the pr again. But apparently it causes the maintainer's trouble. Is there a way to fix this? Thanks.
  22. The constructor of DeferredRegister is private. Use DeferredRegister.create()
  23. What I mean in the second question is do I need to counterfeit how vanilla does it - create class for every single crop, or it is not "needed". If it has its necessarily, is there an alternative way rather than creating class for each crop, but achieves the same target as overriding getSeedsItem()? Since I can't just simply pass the items through the constructor (registration orders), how would I do? Maybe annotation @ObjectHolder can be used if I want to pass the item into the constructor?
  24. Vanilla creates class per plants, for example CarrotBlock, BeetrootBlock, PotatoCrop. They all do the same thing except they return different items in getSeedsItem() which called form Block#getItem. For me it seems a bit redundant, but since items are registered after blocks, you can't pass it through the constructor, so I have two question here: 1. What's the reason of overriding getItem and return getSeedsItem() (the only explanation I can think of is they are not block items), and is it necessary? 2. Is there an alternative way of creating class for each crop? Maybe annotation @ObjectHolder works here?
×
×
  • Create New...

Important Information

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