Jump to content

Kiryu144

Members
  • Posts

    5
  • Joined

  • Last visited

Recent Profile Visitors

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

Kiryu144's Achievements

Tree Puncher

Tree Puncher (2/8)

1

Reputation

  1. In 1.16 I encounter an integer named packedLight very often. I'm assuming the lightlevel is encoded in there somehow, but I'm unable to find any information online on how it is "encoded". Example in the vanilla FontRenderer#renderString(). (1.16)
  2. I'm currently trying to add a new entity, which looks like a smaller version of the player. It all works fine and dandy, except I want the mini-player to fetch the skin of its username. Using the MojangAPI, I fetch the skin url and then use the following code: ResourceLocation resourceLocation = new ResourceLocation("skin/" + uuid); File file = new File("cacheXXX"); Texture texture = new DownloadingTexture(file, skinURL, resourceLocation, true, () -> { System.out.println("test"); }); texture.loadTexture(Minecraft.getInstance().getResourceManager()); Minecraft.getInstance().getTextureManager().loadTexture(resourceLocation, texture); return resourceLocation; I hope that properly binds the skin texture to the resourcelocation. Now using `getEntityTexture` in the renderer, I give it the new skin location. I know that works, because I set the skin to `DefaultPlayerSkin.getDefaultSkinLegacy();` on initialization, before overwriting the variable with the one returned from the top function. The only thing that I could imagine is, that the renderer caches the first resourcelocation returned by `getEntityTexture` and not checks it again. I hope that makes sense!
      • 1
      • Like
  3. Thank you, now with those changes added, my entity now follows the player, like it tries to attack, but doesn't actually attack. @Override protected void registerGoals() { super.registerGoals(); this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 8.0F)); this.goalSelector.addGoal(8, new LookRandomlyGoal(this)); this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, true)); this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); }
  4. I'm adding a new enemy to the game. But when I spawn it, it doesn't attack the player, even though I added the corresponding target selector. I borrowoed most of it from the ZombieEntity class. Here is the class: public class AngrySubEntity extends MonsterEntity { public AngrySubEntity(EntityType<? extends AngrySubEntity> type, World worldIn) { super(type, worldIn); this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 8.0F)); this.goalSelector.addGoal(8, new LookRandomlyGoal(this)); this.goalSelector.addGoal(7, new WaterAvoidingRandomWalkingGoal(this, 1.0D)); this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, PlayerEntity.class, true)); } public static AttributeModifierMap.MutableAttribute createAttributes() { return MonsterEntity.func_234295_eP_() .createMutableAttribute(Attributes.FOLLOW_RANGE, 35.0D) .createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.23F) .createMutableAttribute(Attributes.ATTACK_DAMAGE, 3.0D) .createMutableAttribute(Attributes.ARMOR, 2.0D); } protected int getExperiencePoints(PlayerEntity player) { return 0; } public boolean attackEntityFrom(DamageSource source, float amount) { if (!super.attackEntityFrom(source, amount)) { return false; } else return this.world instanceof ServerWorld; } protected SoundEvent getHurtSound(DamageSource damageSourceIn) { return SoundEvents.ENTITY_ZOMBIE_HURT; } protected SoundEvent getStepSound() { return SoundEvents.ENTITY_ZOMBIE_STEP; } protected void playStepSound(BlockPos pos, BlockState blockIn) { this.playSound(this.getStepSound(), 0.15F, 1.0F); } }
  5. I'm currently working on a purely clientside mod that implements small clay goblins that follow you around. For that I created a new entity named ClaySubEntity. For rendering I am using a custom renderer with the vanilla PlayerModel. But because the playermodel is too big, I scaled them using: @Override public void render(ClaySubEntity entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { entityModel.isSneak = entityIn.isSneaking(); matrixStackIn.scale(entityIn.getScale(), entityIn.getScale(), entityIn.getScale()); super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); } That works completely fine, only the hitbox stays the same size. So when I hit above them, they still die. https://imgur.com/a/6lQMfPf (Note I'm hitting above). Is there a better way to scale down an existing model without breaking the nametag or hitboxes?
×
×
  • Create New...

Important Information

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