-
Posts
1160 -
Joined
-
Days Won
7
Everything posted by poopoodice
-
[1.16] TileEnity has no "read" functiom.
poopoodice replied to KidKoderMod033109's topic in Modder Support
There is, check vanilla for examples. -
[1.16] Can't register Tile Entity with DefferedRegister
poopoodice replied to KidKoderMod033109's topic in Modder Support
No, that means you need to create anothet constructor that has no argument. -
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.
-
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 : )
-
I don't think applying potion effects on client will work as you expected.
-
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.
-
Code, better as a repo.
-
Show all your code, it seems like you have duplicated item/block id or something like that.
-
[1.15]Types of rendering methods and proper use
poopoodice replied to Zemelua's topic in Modder Support
Check ForgeIngameGui, most of UI rendering are done there. -
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.
-
That's because you set it to 0. Use getMotion to get the entity’s motion.
-
Could not resolve all files for configuration ':conpileClasspath'
poopoodice replied to Ron_Parker's topic in Modder Support
L90 -
Weird Cross Block Render Issue (1.16.1)
poopoodice replied to Babelincoln1809's topic in Modder Support
You can see how vanilla set blocks' render type in RenderTypeLookup -
Imo instead of sending stacks, you should probably send the slot numbers and let the server check then modify them.
-
Which class handles the rendering of a tooltip?
poopoodice replied to Tavi007's topic in Modder Support
Make sure you check the element type of the event -
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 : )
-
For example LiteralArgumentBuilder<CommandSource> command = Commands.literal("test"); for(int i=2;i<5;i++) command.then(Commands.literal(Direction.byIndex(i).getString()));
-
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
-
[1.16.3] Chuck Capability Not Registering
poopoodice replied to BeardlessBrady's topic in Modder Support
https://docs.oracle.com/javase/tutorial/java/javaOO/lambdaexpressions.html LazyOptional.of(() -> new TestCapability()) or use :: LazyOptional.of(TestCapability::new) -
[SOLVED] [1.15.2] Storing inventory contents to capability
poopoodice replied to Novârch's topic in Modder Support
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 -
[SOLVED] [1.15.2] Storing inventory contents to capability
poopoodice replied to Novârch's topic in Modder Support
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; } -
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.
-
Coding mod for the first time and can't figure out what this means
poopoodice replied to RandomUser's topic in Modder Support
The constructor of DeferredRegister is private. Use DeferredRegister.create() -
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?
-
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?