Jump to content

Novality

Members
  • Posts

    36
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Novality's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. 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); } }
  2. 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; }
  3. 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
  4. 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
  5. PlayerInteractEvent does not implement IModBusEvent... how do I subscribe to it?
  6. 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.
  7. 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.
  8. Is the list of BlockPos objects just the positions of each bookshelf? Can you help clarify exactly what the list 'BOOKSHELF_OFFSETS' is?
  9. 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
  10. 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?
  11. 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.
  12. 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?
×
×
  • Create New...

Important Information

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