Jump to content

Lucie

Members
  • Posts

    9
  • Joined

  • Last visited

Everything posted by Lucie

  1. I have a custom RenderLayer that renders an icon above an entitys head. The icon rotates to follow the player but the problem im having is that the child model rotates with the parent model which will always make the icon to be off by the amount of the body rotation degrees. The way i fixed it was to use this line of code in the render: poseStack.mulPose(Axis.YP.rotationDegrees(-entity.yBodyRot)); The problem with is now that the model "jitters" everytime the body rotates. I think it happens because it somehow renders the body rotation version and then my negated version which makes it shake. Is there a way to completely disinherit the body rotation from the entity? The Icon model extends EntityModel and the renderer extends Renderlayer, is there anything i can override there?
  2. I had open the MutableComponent's class before posting the thread but looking at that implementation to create multi-colored lines seemed messy and unofficial, but ill take it if it's the only option. ItemStack#getTooltipLines didn't help this case so much but thanks for trying!
  3. For example, how could I combine a "Hello" with ChatFormatting.RED and a "World" with Chatformatting.YELLOW into a chat component looking like this: HelloWorld?
  4. Thank you and thanks for the heads up!
  5. I'm trying to save and load items via compound tags. Back in 1.16 i used these snippets to save and load items. tag.putString("example", item.getRegistryName().toString()); // I used this to store items. ForgeRegistries.ITEMS.getValue(new ResourceLocation(nbt.getString("example"))); // CompoundTag to Item. My question is how i can replicate this in 1.19? It is only the item that i want to save, not an itemstack.
  6. Looking at Player#getDigSpeed i see now how haste actually works, I'll do something similar in PlayerEvent#BreakSpeed. Thank you!
  7. I'm trying to create a mob effect similar to the Haste effect. I copied the code from the Haste effect and changed the UUID. Code below is a snippet from the effect. .addAttributeModifier(Attributes.ATTACK_SPEED, UUID.randomUUID().toString(), 0.1F, AttributeModifier.Operation.MULTIPLY_TOTAL) Testing the effect in Minecraft grants lesser attack speed than Haste even though it uses the exact same value (0.1). How do i fix it?
  8. Ah, I should known "EntityType#spawn" actually spawns the entity. It's all fixed now, thanks for the help.
  9. I'm trying to store mobs inside an item using compounds. To write the mob into compound I use: mob.addAdditionalSaveData(compound); When all data is stored in the item I use this to discard it. mob.discard() The compound also stores the mobs resource location and I use this to spawn and set the data: // Resource location stored in entity tag. EntityType<?> type = ForgeRegistries.ENTITIES.getValue(new ResourceLocation(stack.getOrCreateTag().getString("entity"))); // I use this to get the entity. I'm using 'MobSpawnType.BUCKET' which may not be correct, if so please inform me what else to use. Entity entity = type.spawn(level, stack, null, pos, MobSpawnType.BUCKET, true, false); // Adding data. ((LivingEntity)entity).readAdditionalSaveData(stack.getOrCreateTag().getCompound("data")); // Spawning level.addFreshEntity(entity); When spawning the logger outputs for example: UUID of added entity already exists: Horse['Horse'/128, l='ServerLevel[Test World]', x=-93.50, y=72.00, z=52.50] And the UUID always increments with 2 so if I summon it again it would say 'Horse'/130, 'Horse'/132, 'Horse'/134 etc. How can I prevent this?
×
×
  • Create New...

Important Information

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