Novality
-
Posts
36 -
Joined
-
Last visited
Posts posted by Novality
-
-
Forgot to call defineSynchedData's super method. Case closed.
-
4 hours ago, LakshyaK2011 said:
Hi,
LakshyaK011 Here,
I Was Making A Item When Used In Any Any Hand,
Player's Hand Will Rotate, Just Like Vanilla Item Spy Glass,
When We Use That Item It Moves The Player's Hand Towards Its Face,
How Do I Achieve It?
Take a look at vanilla's source; SpyglassItem.class
Try overriding this method in your item class
@Override public UseAnim getUseAnimation(ItemStack p_151224_) { return UseAnim.SPYGLASS; }
-
Sounds to me like you're writing a modern x-ray mod.. 🤨
Whether you actually are or not take a look at this as it pretty much does what you're looking for
-
Error when trying to summon entity:
[12:09:12] [Server thread/WARN] [minecraft/EntityType]: Exception loading entity: java.lang.NullPointerException: Cannot invoke "net.minecraft.network.syncher.SynchedEntityData$DataItem.getValue()" because "dataitem" is null
I followed these docs to create what I have below in my entity class:
public abstract class Dinosaur extends Animal { static final EntityDataAccessor<Integer> serum = SynchedEntityData.defineId(Dinosaur.class, EntityDataSerializers.INT); protected Dinosaur(EntityType<? extends Animal> e, Level l) { super(e, l); } public boolean isJuvenile() { return this.isBaby() && this.getSerum() > 0; } @Override public void tick() { super.tick(); if (this.getSerum() >= 4) { this.age = 0; if (this.isBaby()) { this.setBaby(false); } } else { if (!this.isBaby()) { this.setBaby(true); } this.age = -20; } } @Override public void defineSynchedData() { this.entityData.define(serum, 1); } public void addSerum() { int s = this.getSerum(); this.getEntityData().set(serum, s++); } public int getSerum() { return this.getEntityData().get(serum); } }
Any help is greatly appreciated, thank you
-
PlayerInteractEvent does not implement IModBusEvent... how do I subscribe to it?
-
Nevermind I figured it out
-
11 hours ago, warjort said:
PufferFishRenderer except you would use the "age" instead of the "puffState" to determine the model.
I've updated my code to an extent but I hit a brick wall when thinking about how to create multiple ModelLayerLocation for the same entity. I'm getting "no model for layer blah blah:blah ..." errors.
-
How would I go about rendering a different model (maybe three) for an entity depending on it's age? How can I even access age information about the entity from it's model class?
Ex:
at -60 minutes : render infant model
at -20 minutes : render juvenile model
at 0+ minutes (when no longer baby) : render normal model
I've tried looking online for similar posts and looking through minecraft's source code and I couldn't find anything. Help would be GREATLY appreciated. -
10 hours ago, Luis_ST said:
Take a look at EnchantmentTableBlock#animateTick
Is the list of BlockPos objects just the positions of each bookshelf? Can you help clarify exactly what the list 'BOOKSHELF_OFFSETS' is?
-
Hi there, this is something I've been struggling to figure out for the last week or so. I will not be posting and prior code I had because of how many different approaches I've tried.
I've tried looking at vanilla's enchant table and bookshelf block classes and imitating that, I've looked through dozens of old forum posts about particles yet none of it has helped.
Essentially, I want to recreate the enchant particles that move from bookshelf to the center of the enchantment table. But for my custom block classes; I have one block that would represent a bookshelf and one that would represent an enchantment table in this case.
Thanks for any help in advance. I appreciate it -
1 hour ago, diesieben07 said:
Primitives cannot be null. It will be 0.
Cool, thanks.
-
48 minutes ago, diesieben07 said:
LivingEntity#hurtTime will tell you if the entity is currently showing the red hurt animation.
I'm looking at the class, I see it's an integer. What value will it hold if no animation is showing? 0 or null?
-
I know that the server sends a packet to the client to register the red tint animation on damaged.. I've tried overriding performHurtAnimation() as a workaround to find when the player is damaged.. nothing came from that. The last thing I could do is interpret the packet.. but I don't even know where to start. If someone could point me in the right direction that would be great. My goal is to play an additional animation when the player is damaged - in addition to the already existent red tint.
-
1 hour ago, diesieben07 said:
You should really consider not doing this. If multiple mods do this, the menu will quickly become completely unusable.
Why do you want to do this?
If you must add a button to an existing screen against all advice then you need to use GuiScreenEvent.InitGuiEvent.
I understand the concern and possibility of unfriendly mod compatibility. I'll be sure to add an option to disable it then as I'll probably have a keybind to open the same gui as well. The button will be there though, at the very bottom of the screen to bring user's attention to configuration.
I've actually played around with GuiScreenEvent.InitGuiEvent before and I don't recall being able to add a button to the button list? -
package novality; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiIngameMenu; public class NovalityAddButton extends GuiIngameMenu { private GuiButton mEnter; }
I don't really know where to go from here. If anyone could point me in the right direction, that would be great. I want my button to open another gui I created that extends from GuiScreen.
-
9 hours ago, diesieben07 said:
You need to count ticks. 1 tick takes 50ms (20 ticks are 1000ms which is 1 second). So for a 1000ms delay you need to wait 20 ticks.
Yep, but can I use tick delays without creating a separate tick counter method?
-
I want to create a 1000ms delay in my java method without pausing the game. Is this possible? If so an example would be nice
Ex:
doThing()//1000ms delay
doAnotherThing() -
6 hours ago, Luis_ST said:
look at a mod that does exactly what you want to do
Unfortunately, I am not familiar with tooltips, but will try a bit and I give you an answer when I find something that worksI found a solution
Thanks for the help though! -
Just now, Luis_ST said:
okay sorry about that😅, then define "animated", did you mean the color, font type (bold), ...?
No worries! I was looking for something that will periodically bold and unbold green text. But anything specific isn't really needed. An example would be best!
-
7 hours ago, Luis_ST said:
Basically, animating an item is nothing else than water, which is an animated block,
you need a texture with the size / height 16/16 * x (x indicates the number of individual textures),
and you need a file_name.png .mcmeta file which handle the animationtake a look at how the water animation works
You seem to have missed the point of the question. I want an animated tooltip not an animated item texture which can be easily done. 😄
-
I know how to add advanced tooltips, and regular item lore.
I've started to explore a bit and ended up pondering animated item lore. I've seen mods that have it, and I was wondering if there was a somewhat simple way that I could do this too!Any help is greatly appreciated
-
NEVERMIND.
I found something that works for me:MinecraftServer source = LogicalSidedProvider.INSTANCE.get(LogicalSide.SERVER);
Topic SOLVED
-
1 hour ago, diesieben07 said:
MinecraftServer#getCommands().performCommand(source, command).
command is the command you want to run, source is the CommandSource for it. To use the same one the console uses, use MinecraftServer#createCommandSourceStack.
Thanks, but I'm having an issue grabbing the MinecraftServer variable.
My code:MinecraftServer source = MinecraftServer.getServer(); source.getCommands().performCommand(source.createCommandSourceStack(), "say hi");
It doesn't seem to recognize "getServer()" -
7 hours ago, poopoodice said:
You can run servers and then execute commands there.
That has nothing to do with what I asked?
[1.19.2] Best practical way to save entity data?
in Modder Support
Posted
Firstly is this thread relevant?
Secondly, if you have an opinion on this, make it known please. I'm looking for a practical way to save entity data. If you want to see my entity class, it's below. I'm looking to save the serum variable. What I have right now works fine but it does not save across world joins.