Everything posted by Novality
-
[1.19.2] Best practical way to save entity data?
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. 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() { super.defineSynchedData(); this.entityData.define(serum, 0); } public void addSerum() { int s = this.getSerum(); s++; this.getEntityData().set(serum, s); } public int getSerum() { return this.getEntityData().get(serum); } }
-
[1.19.2] Cannot invoke "net.minecraft.network.syncher.SynchedEntityData$DataItem.getValue()" because "dataitem" is null
Forgot to call defineSynchedData's super method. Case closed.
-
How Do I Change Player Model?
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; }
-
Set block as invisible on client side [1.19]
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
-
[1.19.2] Cannot invoke "net.minecraft.network.syncher.SynchedEntityData$DataItem.getValue()" because "dataitem" is null
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
-
[1.19.2] PlayerInteractEvent#EntityInteract
PlayerInteractEvent does not implement IModBusEvent... how do I subscribe to it?
-
[1.19.2] Multiple models for the same entity depending on it's age
Nevermind I figured it out
-
[1.19.2] Multiple models for the same entity depending on it's age
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.
-
[1.19.2] Multiple models for the same entity depending on it's age
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.
-
[1.19.2] Replicating vanilla's enchantment table particles
Is the list of BlockPos objects just the positions of each bookshelf? Can you help clarify exactly what the list 'BOOKSHELF_OFFSETS' is?
-
[1.19.2] Replicating vanilla's enchantment table particles
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.16.5] Client-side, detecting when player is damaged
Cool, thanks.
-
[1.16.5] Client-side, detecting when player is damaged
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?
-
[1.16.5] Client-side, detecting when player is damaged
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.16.5] Adding a gui button to the vanilla in-game menu
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?
-
[1.16.5] Adding a gui button to the vanilla in-game menu
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.
-
[1.16.5] Creating a delay in method without pausing the game
Yep, but can I use tick delays without creating a separate tick counter method?
-
[1.16.5] Creating a delay in method without pausing the game
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()
-
[1.16.5] Simple way to add animated item lore? [SOLVED]
I found a solution Thanks for the help though!
-
[1.16.5] Simple way to add animated item lore? [SOLVED]
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!
-
[1.16.5] Simple way to add animated item lore? [SOLVED]
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. ๐
-
[1.16.5] Simple way to add animated item lore? [SOLVED]
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
-
[1.16.5] Executing a command as server console [SOLVED]
NEVERMIND. I found something that works for me: MinecraftServer source = LogicalSidedProvider.INSTANCE.get(LogicalSide.SERVER); Topic SOLVED
-
[1.16.5] Executing a command as server console [SOLVED]
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()"
-
[1.16.5] Executing a command as server console [SOLVED]
That has nothing to do with what I asked?
IPS spam blocked by CleanTalk.