Jump to content

No132

Members
  • Posts

    6
  • Joined

  • Last visited

Everything posted by No132

  1. Snippets? I didnt knew this word before,sorry for my bad Englisch. So if you know nothing,then why do you come and write answers here? And my hurt method actually does something you can go and paste this to your entity hurt method. Write if you will ever have some useful information about this problem. Thanks.
  2. Ok, That line do not gets called so yes It does not work. It can not have health or everything will crash,so its not a problem( Yeah it just do not works becouse minecraft do not want to call hurt method and I dont know what do with this My bad, I changed the Names of the classes and resourse locations when I was posting to make it more readable. Also can I ask does this code works by you? Maybe the problem not in the code.
  3. The Code prints "Hurt method called!", also even if I add getParent().hurt(DamageSourse.Anvil,1000); that will not work, also part entity has no health by default.I looked at the code at debug mode and the method just do not called.
  4. Here is ParentEntityCopy public class ParentEntityCopy extends PartEntity<ParentEntity> { public static final ResourceLocation RENDERER = new ResourceLocation(MOD_ID.MOD_ID,"textures/entity/ParentEntity.png"); public EntityDimensions Size; public ParentEntityCopy(ParentEntity parent) { super(parent); this.setSize(EntityDimensions.scalable(1.8F, 3F)); setInvisible(false); setInvulnerable(false); } @OnlyIn(Dist.CLIENT) public ResourceLocation renderer() { return RENDERER; } protected void setSize(EntityDimensions size) { this.Size = size; refreshDimensions(); } @Override public boolean isPickable() { return true; } @Override public EntityDimensions getDimensions(Pose poseIn) { return Size; } @Override protected void defineSynchedData() { } @Override protected void readAdditionalSaveData(CompoundTag pCompound) { } @Override public void tick() { super.tick(); moveTo(getX(), getY(), getZ()); this.tickCount++; yRotO = getYRot(); xRotO = getXRot(); } @Override protected void addAdditionalSaveData(CompoundTag pCompound) { } @Override public boolean hurt(DamageSource source, float amount) { System.out.println("Hurt method called!"); return super.hurt(source, amount); } @Override public void setRot(float yaw, float pitch) { super.setRot(yaw, pitch); } }
  5. Here is the Parent Class ublic class ParentEntity extends Monster { private final ParentEntityCopy[] copyarr = new ParentEntityCopy[1]; private int tostart = 0; public ParentEntity(EntityType<? extends Monster> type, Level level) { super(type, level); this.noCulling = true; for (int i = 0; i < copyarr.length; i++) { copyarr[i] = new ParentEntityCopy(this); } } @Override protected void registerGoals() { this.goalSelector.addGoal(0, new FloatGoal(this)); this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.0D, false)); } public static AttributeSupplier.Builder registerAttributes() { return Monster.createMobAttributes() .add(Attributes.MAX_HEALTH, 10.0D) .add(Attributes.ARMOR, 10.0D) .add(Attributes.ATTACK_DAMAGE, 10.0D) .add(Attributes.MOVEMENT_SPEED, 1D) .add(Attributes.FOLLOW_RANGE, 64.0D); } @Override public void tick() { super.tick(); for (int i = 0; i < copyarr.length; i++) { ParentEntityCopy copy = copyarr[i]; copy.tick(); if (tostart == 0){ copy.setPos(getX(),getY(),getZ()); } } tostart = 1; } @Override public boolean hurt(DamageSource pSource, float pAmount) { return super.hurt(pSource, pAmount); } @Override public void remove(RemovalReason reason) { super.remove(reason); if (this.level instanceof ServerLevel) { for (ParentEntityCopy part : copyarr) { part.remove(RemovalReason.KILLED); } } } @Nullable @Override public PartEntity<?>[] getParts() { return copyarr; } @Override public boolean isMultipartEntity() { return true; } }
  6. I made a custom multipart entity,but after some time it just stops taking damage. I think I done everything corectly (I can post a code if needed). I think there is some kind of problem with getDimensions method, can someone help me?
×
×
  • Create New...

Important Information

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