Jump to content

Help with porting entities from 1.15.2 to 1.17.1


Jeremy Quann

Recommended Posts

I need some help from you guys out there to get this code a fixer-upper:

package tld.sullysmod.modid.entity;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Random;
import java.util.function.BiFunction;
import net.minecraft.block.BlockState;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.entity.CreatureAttribute;
import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.controller.FlyingMovementController;
import net.minecraft.entity.ai.controller.MovementController;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
import net.minecraft.entity.ai.goal.RandomWalkingGoal;
import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.item.Items;
import net.minecraft.item.SpawnEggItem;
import net.minecraft.network.IPacket;
import net.minecraft.pathfinding.FlyingPathNavigator;
import net.minecraft.pathfinding.PathNavigator;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraft.world.biome.Biome;
import net.minecraft.world.gen.Heightmap;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.common.DungeonHooks;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.network.FMLPlayMessages;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.IForgeRegistryEntry;
import tld.sullysmod.modid.SullysModModElements;
import tld.sullysmod.modid.SullysModModElements.ModElement.Tag;
import tld.sullysmod.modid.procedures.BabyWitherPlayerCollidesWithThisEntityProcedure;

@Tag
public class BabyWitherEntity extends SullysModModElements.ModElement {
  public static EntityType entity = null;
  
  public BabyWitherEntity(SullysModModElements instance) {
    super(instance, 2);
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
  }
  
  public void initElements() {
    entity = (EntityType)EntityType.Builder.func_220322_a(CustomEntity::new, EntityClassification.MONSTER).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(CustomEntity::new).func_220320_c().func_220321_a(0.6F, 1.8F).func_206830_a("witherling").setRegistryName("witherling");
    this.elements.entities.add(() -> entity);
    this.elements.items
      .add(() -> (Item)(new SpawnEggItem(entity, -13355980, -5921371, (new Item.Properties()).func_200916_a(ItemGroup.field_78026_f))).setRegistryName("witherling"));
  }
  
  public void init(FMLCommonSetupEvent event) {
    for (Biome biome : ForgeRegistries.BIOMES.getValues()) {
      boolean biomeCriteria = false;
      if (ForgeRegistries.BIOMES.getKey((IForgeRegistryEntry)biome).equals(new ResourceLocation("nether")))
        biomeCriteria = true; 
      if (!biomeCriteria)
        continue; 
      biome.func_76747_a(EntityClassification.MONSTER).add(new Biome.SpawnListEntry(entity, 3, 1, 2));
    } 
    EntitySpawnPlacementRegistry.func_209343_a(entity, EntitySpawnPlacementRegistry.PlacementType.ON_GROUND, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, MonsterEntity::func_223324_d);
    DungeonHooks.addDungeonMob(entity, 180);
  }
  
  @SubscribeEvent
  @OnlyIn(Dist.CLIENT)
  public void registerModels(ModelRegistryEvent event) {
    RenderingRegistry.registerEntityRenderingHandler(entity, renderManager -> new MobRenderer(renderManager, new ModelMiniWither(), 0.2F) {
          public ResourceLocation func_110775_a(Entity entity) {
            return new ResourceLocation("sullys_mod:textures/miniwithernormalstate.png");
          }
        });
  }
  
  public static class CustomEntity extends MonsterEntity {
    public CustomEntity(FMLPlayMessages.SpawnEntity packet, World world) {
      this(BabyWitherEntity.entity, world);
    }
    
    public CustomEntity(EntityType<CustomEntity> type, World world) {
      super(type, world);
      this.field_70728_aV = 0;
      func_94061_f(false);
      this.field_70765_h = (MovementController)new FlyingMovementController((MobEntity)this, 10, true);
      this.field_70699_by = (PathNavigator)new FlyingPathNavigator((MobEntity)this, this.field_70170_p);
    }
    
    public IPacket<?> func_213297_N() {
      return NetworkHooks.getEntitySpawningPacket((Entity)this);
    }
    
    protected void func_184651_r() {
      super.func_184651_r();
      this.field_70714_bg.func_75776_a(1, new Goal() {
            public boolean func_75250_a() {
              if (BabyWitherEntity.CustomEntity.this.func_70638_az() != null && !BabyWitherEntity.CustomEntity.this.func_70605_aq().func_75640_a())
                return true; 
              return false;
            }
            
            public boolean func_75253_b() {
              return (BabyWitherEntity.CustomEntity.this.func_70605_aq().func_75640_a() && BabyWitherEntity.CustomEntity.this.func_70638_az() != null && BabyWitherEntity.CustomEntity.this
                .func_70638_az().func_70089_S());
            }
            
            public void func_75249_e() {
              LivingEntity livingentity = BabyWitherEntity.CustomEntity.this.func_70638_az();
              Vec3d vec3d = livingentity.func_174824_e(1.0F);
              BabyWitherEntity.CustomEntity.this.field_70765_h.func_75642_a(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 1.0D);
            }
            
            public void func_75246_d() {
              LivingEntity livingentity = BabyWitherEntity.CustomEntity.this.func_70638_az();
              if (BabyWitherEntity.CustomEntity.this.func_174813_aQ().func_72326_a(livingentity.func_174813_aQ())) {
                BabyWitherEntity.CustomEntity.this.func_70652_k((Entity)livingentity);
              } else {
                double d0 = BabyWitherEntity.CustomEntity.this.func_70068_e((Entity)livingentity);
                if (d0 < 16.0D) {
                  Vec3d vec3d = livingentity.func_174824_e(1.0F);
                  BabyWitherEntity.CustomEntity.this.field_70765_h.func_75642_a(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 1.0D);
                } 
              } 
            }
          });
      this.field_70715_bh.func_75776_a(2, (Goal)(new HurtByTargetGoal((CreatureEntity)this, new Class[0])).func_220794_a(new Class[] { getClass() }));
      this.field_70714_bg.func_75776_a(3, (Goal)new RandomWalkingGoal((CreatureEntity)this, 0.8D, 20) {
            protected Vec3d func_190864_f() {
              Random random = BabyWitherEntity.CustomEntity.this.func_70681_au();
              double dir_x = BabyWitherEntity.CustomEntity.this.func_226277_ct_() + ((random.nextFloat() * 2.0F - 1.0F) * 16.0F);
              double dir_y = BabyWitherEntity.CustomEntity.this.func_226278_cu_() + ((random.nextFloat() * 2.0F - 1.0F) * 16.0F);
              double dir_z = BabyWitherEntity.CustomEntity.this.func_226281_cx_() + ((random.nextFloat() * 2.0F - 1.0F) * 16.0F);
              return new Vec3d(dir_x, dir_y, dir_z);
            }
          });
      this.field_70714_bg.func_75776_a(4, (Goal)new WaterAvoidingRandomWalkingGoal((CreatureEntity)this, 0.8D));
      this.field_70714_bg.func_75776_a(5, (Goal)new LookRandomlyGoal((MobEntity)this));
    }
    
    public CreatureAttribute func_70668_bt() {
      return CreatureAttribute.field_223223_b_;
    }
    
    protected void func_213333_a(DamageSource source, int looting, boolean recentlyHitIn) {
      super.func_213333_a(source, looting, recentlyHitIn);
      func_199701_a_(new ItemStack((IItemProvider)Items.field_196183_dw, 1));
    }
    
    public SoundEvent func_184601_bQ(DamageSource ds) {
      return (SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("sullys_mod:babywitherhurt"));
    }
    
    public SoundEvent func_184615_bR() {
      return (SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("sullys_mod:babywitherdeath"));
    }
    
    public boolean func_225503_b_(float l, float d) {
      return false;
    }
    
    public boolean func_70097_a(DamageSource source, float amount) {
      if (source == DamageSource.field_76379_h)
        return false; 
      if (source == DamageSource.field_76369_e)
        return false; 
      return super.func_70097_a(source, amount);
    }
    
    public void func_70100_b_(PlayerEntity sourceentity) {
      super.func_70100_b_(sourceentity);
      CustomEntity customEntity = this;
      double x = func_226277_ct_();
      double y = func_226278_cu_();
      double z = func_226281_cx_();
      Map<String, Object> $_dependencies = new HashMap<>();
      $_dependencies.put("entity", customEntity);
      $_dependencies.put("x", Double.valueOf(x));
      $_dependencies.put("y", Double.valueOf(y));
      $_dependencies.put("z", Double.valueOf(z));
      $_dependencies.put("world", this.field_70170_p);
      BabyWitherPlayerCollidesWithThisEntityProcedure.executeProcedure($_dependencies);
    }
    
    protected void func_110147_ax() {
      super.func_110147_ax();
      if (func_110148_a(SharedMonsterAttributes.field_111263_d) != null)
        func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.3D); 
      if (func_110148_a(SharedMonsterAttributes.field_111267_a) != null)
        func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(20.0D); 
      if (func_110148_a(SharedMonsterAttributes.field_188791_g) != null)
        func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(0.0D); 
      if (func_110148_a(SharedMonsterAttributes.field_111264_e) == null)
        func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111264_e); 
      func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D);
      if (func_110148_a(SharedMonsterAttributes.field_193334_e) == null)
        func_110140_aT().func_111150_b(SharedMonsterAttributes.field_193334_e); 
      func_110148_a(SharedMonsterAttributes.field_193334_e).func_111128_a(0.3D);
    }
    
    protected void func_184231_a(double y, boolean onGroundIn, BlockState state, BlockPos pos) {}
    
    public void func_189654_d(boolean ignored) {
      super.func_189654_d(true);
    }
    
    public void func_70636_d() {
      super.func_70636_d();
      func_189654_d(true);
    }
  }
  
  public static class ModelMiniWither extends EntityModel<Entity> {
    private final ModelRenderer Head;
    
    private final ModelRenderer bone3;
    
    private final ModelRenderer Body;
    
    private final ModelRenderer bone;
    
    private final ModelRenderer bone2;
    
    public ModelMiniWither() {
      this.field_78090_t = 44;
      this.field_78089_u = 20;
      this.Head = new ModelRenderer((Model)this);
      this.Head.func_78793_a(-1.0F, 12.0F, 1.0F);
      setRotationAngle(this.Head, 0.0F, 0.0F, -0.0873F);
      this.Head.func_78784_a(0, 0).func_228303_a_(-3.0535F, -5.8714F, -4.0F, 6.0F, 6.0F, 6.0F, 0.0F, false);
      this.bone3 = new ModelRenderer((Model)this);
      this.bone3.func_78793_a(1.9503F, -0.9585F, 1.0F);
      this.Head.func_78792_a(this.bone3);
      setRotationAngle(this.bone3, 0.0F, -0.1745F, 0.1745F);
      this.bone3.func_78784_a(24, 0).func_228303_a_(-0.4524F, -2.8083F, -3.9892F, 5.0F, 5.0F, 5.0F, 0.0F, false);
      this.Body = new ModelRenderer((Model)this);
      this.Body.func_78793_a(0.0F, 13.0F, 0.0F);
      setRotationAngle(this.Body, 0.1745F, 0.0F, 0.0F);
      this.Body.func_78784_a(0, 12).func_228303_a_(-1.0F, -0.8112F, 0.1585F, 2.0F, 6.0F, 2.0F, 0.0F, false);
      this.bone = new ModelRenderer((Model)this);
      this.bone.func_78793_a(0.0F, 0.0F, 0.0F);
      this.Body.func_78792_a(this.bone);
      setRotationAngle(this.bone, 0.4363F, 0.0F, 0.0F);
      this.bone.func_78784_a(8, 12).func_228303_a_(-1.0F, 4.847F, -1.804F, 2.0F, 4.0F, 2.0F, 0.0F, false);
      this.bone2 = new ModelRenderer((Model)this);
      this.bone2.func_78793_a(0.0F, 0.0152F, 0.1736F);
      this.Body.func_78792_a(this.bone2);
      setRotationAngle(this.bone2, 0.1745F, 0.0F, 0.0F);
      this.bone2.func_78784_a(14, 16).func_228303_a_(-3.0F, 0.9544F, -0.5209F, 6.0F, 2.0F, 2.0F, 0.0F, false);
      this.bone2.func_78784_a(14, 16).func_228303_a_(-3.0F, 5.241F, 0.7541F, 6.0F, 2.0F, 2.0F, 0.0F, false);
    }
    
    public void func_225598_a_(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
      this.Head.func_228308_a_(matrixStack, buffer, packedLight, packedOverlay);
      this.Body.func_228308_a_(matrixStack, buffer, packedLight, packedOverlay);
    }
    
    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
      modelRenderer.field_78795_f = x;
      modelRenderer.field_78796_g = y;
      modelRenderer.field_78808_h = z;
    }
    
    public void func_225597_a_(Entity e, float f, float f1, float f2, float f3, float f4) {}
  }
}

 

package tld.sullysmod.modid.entity;

import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.vertex.IVertexBuilder;
import java.util.EnumSet;
import java.util.Random;
import java.util.function.BiFunction;
import net.minecraft.block.BlockState;
import net.minecraft.block.Blocks;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.client.renderer.entity.model.EntityModel;
import net.minecraft.client.renderer.model.Model;
import net.minecraft.client.renderer.model.ModelRenderer;
import net.minecraft.entity.CreatureAttribute;
import net.minecraft.entity.CreatureEntity;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.IRangedAttackMob;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.controller.FlyingMovementController;
import net.minecraft.entity.ai.controller.MovementController;
import net.minecraft.entity.ai.goal.Goal;
import net.minecraft.entity.ai.goal.HurtByTargetGoal;
import net.minecraft.entity.ai.goal.LookRandomlyGoal;
import net.minecraft.entity.ai.goal.NearestAttackableTargetGoal;
import net.minecraft.entity.ai.goal.RandomWalkingGoal;
import net.minecraft.entity.ai.goal.RangedAttackGoal;
import net.minecraft.entity.ai.goal.WaterAvoidingRandomWalkingGoal;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.passive.AmbientEntity;
import net.minecraft.entity.passive.AnimalEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.network.IPacket;
import net.minecraft.pathfinding.FlyingPathNavigator;
import net.minecraft.pathfinding.PathNavigator;
import net.minecraft.util.DamageSource;
import net.minecraft.util.IItemProvider;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.fml.network.FMLPlayMessages;
import net.minecraftforge.fml.network.NetworkHooks;
import net.minecraftforge.registries.ForgeRegistries;
import tld.sullysmod.modid.SullysModModElements;
import tld.sullysmod.modid.SullysModModElements.ModElement.Tag;
import tld.sullysmod.modid.item.TinywitherItem;

@Tag
public class AngryWitherEntity extends SullysModModElements.ModElement {
  public static EntityType entity = null;
  
  public AngryWitherEntity(SullysModModElements instance) {
    super(instance, 7);
    FMLJavaModLoadingContext.get().getModEventBus().register(this);
  }
  
  public void initElements() {
    entity = (EntityType)EntityType.Builder.func_220322_a(CustomEntity::new, EntityClassification.MONSTER).setShouldReceiveVelocityUpdates(true).setTrackingRange(64).setUpdateInterval(3).setCustomClientFactory(CustomEntity::new).func_220320_c().func_220321_a(0.6F, 1.8F).func_206830_a("angry_witherling").setRegistryName("angry_witherling");
    this.elements.entities.add(() -> entity);
  }
  
  @SubscribeEvent
  @OnlyIn(Dist.CLIENT)
  public void registerModels(ModelRegistryEvent event) {
    RenderingRegistry.registerEntityRenderingHandler(entity, renderManager -> new MobRenderer(renderManager, new ModelMiniWither(), 0.5F) {
          public ResourceLocation func_110775_a(Entity entity) {
            return new ResourceLocation("sullys_mod:textures/miniwitherdefencestate.png");
          }
        });
  }
  
  public static class CustomEntity extends MonsterEntity implements IRangedAttackMob {
    public CustomEntity(FMLPlayMessages.SpawnEntity packet, World world) {
      this(AngryWitherEntity.entity, world);
    }
    
    public CustomEntity(EntityType<CustomEntity> type, World world) {
      super(type, world);
      this.field_70728_aV = 6;
      func_94061_f(false);
      func_110163_bv();
      this.field_70765_h = (MovementController)new FlyingMovementController((MobEntity)this, 10, true);
      this.field_70699_by = (PathNavigator)new FlyingPathNavigator((MobEntity)this, this.field_70170_p);
    }
    
    public IPacket<?> func_213297_N() {
      return NetworkHooks.getEntitySpawningPacket((Entity)this);
    }
    
    protected void func_184651_r() {
      super.func_184651_r();
      this.field_70715_bh.func_75776_a(1, (Goal)new NearestAttackableTargetGoal((MobEntity)this, PlayerEntity.class, false, false));
      this.field_70715_bh.func_75776_a(2, (Goal)new NearestAttackableTargetGoal((MobEntity)this, AmbientEntity.class, false, false));
      this.field_70715_bh.func_75776_a(3, (Goal)new NearestAttackableTargetGoal((MobEntity)this, AnimalEntity.class, false, false));
      this.field_70714_bg.func_75776_a(4, new Goal() {
            public boolean func_75250_a() {
              if (AngryWitherEntity.CustomEntity.this.func_70638_az() != null && !AngryWitherEntity.CustomEntity.this.func_70605_aq().func_75640_a())
                return true; 
              return false;
            }
            
            public boolean func_75253_b() {
              return (AngryWitherEntity.CustomEntity.this.func_70605_aq().func_75640_a() && AngryWitherEntity.CustomEntity.this.func_70638_az() != null && AngryWitherEntity.CustomEntity.this
                .func_70638_az().func_70089_S());
            }
            
            public void func_75249_e() {
              LivingEntity livingentity = AngryWitherEntity.CustomEntity.this.func_70638_az();
              Vec3d vec3d = livingentity.func_174824_e(1.0F);
              AngryWitherEntity.CustomEntity.this.field_70765_h.func_75642_a(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 1.0D);
            }
            
            public void func_75246_d() {
              LivingEntity livingentity = AngryWitherEntity.CustomEntity.this.func_70638_az();
              if (AngryWitherEntity.CustomEntity.this.func_174813_aQ().func_72326_a(livingentity.func_174813_aQ())) {
                AngryWitherEntity.CustomEntity.this.func_70652_k((Entity)livingentity);
              } else {
                double d0 = AngryWitherEntity.CustomEntity.this.func_70068_e((Entity)livingentity);
                if (d0 < 16.0D) {
                  Vec3d vec3d = livingentity.func_174824_e(1.0F);
                  AngryWitherEntity.CustomEntity.this.field_70765_h.func_75642_a(vec3d.field_72450_a, vec3d.field_72448_b, vec3d.field_72449_c, 1.0D);
                } 
              } 
            }
          });
      this.field_70715_bh.func_75776_a(5, (Goal)(new HurtByTargetGoal((CreatureEntity)this, new Class[0])).func_220794_a(new Class[] { getClass() }));
      this.field_70714_bg.func_75776_a(6, (Goal)new RandomWalkingGoal((CreatureEntity)this, 0.7D, 20) {
            protected Vec3d func_190864_f() {
              Random random = AngryWitherEntity.CustomEntity.this.func_70681_au();
              double dir_x = AngryWitherEntity.CustomEntity.this.func_226277_ct_() + ((random.nextFloat() * 2.0F - 1.0F) * 16.0F);
              double dir_y = AngryWitherEntity.CustomEntity.this.func_226278_cu_() + ((random.nextFloat() * 2.0F - 1.0F) * 16.0F);
              double dir_z = AngryWitherEntity.CustomEntity.this.func_226281_cx_() + ((random.nextFloat() * 2.0F - 1.0F) * 16.0F);
              return new Vec3d(dir_x, dir_y, dir_z);
            }
          });
      this.field_70714_bg.func_75776_a(7, (Goal)new WaterAvoidingRandomWalkingGoal((CreatureEntity)this, 1.0D));
      this.field_70714_bg.func_75776_a(8, (Goal)new LookRandomlyGoal((MobEntity)this));
      this.field_70714_bg.func_75776_a(1, (Goal)new RangedAttackGoal(this, 1.25D, 20, 10.0F) {
            public boolean func_75253_b() {
              return func_75250_a();
            }
          });
    }
    
    public CreatureAttribute func_70668_bt() {
      return CreatureAttribute.field_223223_b_;
    }
    
    public boolean func_213397_c(double distanceToClosestPlayer) {
      return false;
    }
    
    protected void func_213333_a(DamageSource source, int looting, boolean recentlyHitIn) {
      super.func_213333_a(source, looting, recentlyHitIn);
      func_199701_a_(new ItemStack((IItemProvider)Blocks.field_222388_bz, 1));
    }
    
    public SoundEvent func_184601_bQ(DamageSource ds) {
      return (SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("sullys_mod:babywitherhurt"));
    }
    
    public SoundEvent func_184615_bR() {
      return (SoundEvent)ForgeRegistries.SOUND_EVENTS.getValue(new ResourceLocation("sullys_mod:babywitherdeath"));
    }
    
    public boolean func_225503_b_(float l, float d) {
      return false;
    }
    
    public boolean func_70097_a(DamageSource source, float amount) {
      if (source == DamageSource.field_76379_h)
        return false; 
      if (source == DamageSource.field_76369_e)
        return false; 
      return super.func_70097_a(source, amount);
    }
    
    protected void func_110147_ax() {
      super.func_110147_ax();
      if (func_110148_a(SharedMonsterAttributes.field_111263_d) != null)
        func_110148_a(SharedMonsterAttributes.field_111263_d).func_111128_a(0.3D); 
      if (func_110148_a(SharedMonsterAttributes.field_111267_a) != null)
        func_110148_a(SharedMonsterAttributes.field_111267_a).func_111128_a(40.0D); 
      if (func_110148_a(SharedMonsterAttributes.field_188791_g) != null)
        func_110148_a(SharedMonsterAttributes.field_188791_g).func_111128_a(0.0D); 
      if (func_110148_a(SharedMonsterAttributes.field_111264_e) == null)
        func_110140_aT().func_111150_b(SharedMonsterAttributes.field_111264_e); 
      func_110148_a(SharedMonsterAttributes.field_111264_e).func_111128_a(3.0D);
      if (func_110148_a(SharedMonsterAttributes.field_193334_e) == null)
        func_110140_aT().func_111150_b(SharedMonsterAttributes.field_193334_e); 
      func_110148_a(SharedMonsterAttributes.field_193334_e).func_111128_a(0.3D);
    }
    
    public void func_82196_d(LivingEntity target, float flval) {
      TinywitherItem.shoot((LivingEntity)this, target);
    }
    
    protected void func_184231_a(double y, boolean onGroundIn, BlockState state, BlockPos pos) {}
    
    public void func_189654_d(boolean ignored) {
      super.func_189654_d(true);
    }
    
    public void func_70636_d() {
      super.func_70636_d();
      func_189654_d(true);
    }
  }
  
  public static class ModelMiniWither extends EntityModel<Entity> {
    private final ModelRenderer Head;
    
    private final ModelRenderer bone3;
    
    private final ModelRenderer Body;
    
    private final ModelRenderer bone;
    
    private final ModelRenderer bone2;
    
    public ModelMiniWither() {
      this.field_78090_t = 44;
      this.field_78089_u = 20;
      this.Head = new ModelRenderer((Model)this);
      this.Head.func_78793_a(-1.0F, 12.0F, 1.0F);
      setRotationAngle(this.Head, 0.0F, 0.0F, -0.0873F);
      this.Head.func_78784_a(0, 0).func_228303_a_(-3.0535F, -5.8714F, -4.0F, 6.0F, 6.0F, 6.0F, 0.0F, false);
      this.bone3 = new ModelRenderer((Model)this);
      this.bone3.func_78793_a(1.9503F, -0.9585F, 1.0F);
      this.Head.func_78792_a(this.bone3);
      setRotationAngle(this.bone3, 0.0F, -0.1745F, 0.1745F);
      this.bone3.func_78784_a(24, 0).func_228303_a_(-0.4524F, -2.8083F, -3.9892F, 5.0F, 5.0F, 5.0F, 0.0F, false);
      this.Body = new ModelRenderer((Model)this);
      this.Body.func_78793_a(0.0F, 13.0F, 0.0F);
      setRotationAngle(this.Body, 0.1745F, 0.0F, 0.0F);
      this.Body.func_78784_a(0, 12).func_228303_a_(-1.0F, -0.8112F, 0.1585F, 2.0F, 6.0F, 2.0F, 0.0F, false);
      this.bone = new ModelRenderer((Model)this);
      this.bone.func_78793_a(0.0F, 0.0F, 0.0F);
      this.Body.func_78792_a(this.bone);
      setRotationAngle(this.bone, 0.4363F, 0.0F, 0.0F);
      this.bone.func_78784_a(8, 12).func_228303_a_(-1.0F, 4.847F, -1.804F, 2.0F, 4.0F, 2.0F, 0.0F, false);
      this.bone2 = new ModelRenderer((Model)this);
      this.bone2.func_78793_a(0.0F, 0.0152F, 0.1736F);
      this.Body.func_78792_a(this.bone2);
      setRotationAngle(this.bone2, 0.1745F, 0.0F, 0.0F);
      this.bone2.func_78784_a(14, 16).func_228303_a_(-3.0F, 0.9544F, -0.5209F, 6.0F, 2.0F, 2.0F, 0.0F, false);
      this.bone2.func_78784_a(14, 16).func_228303_a_(-3.0F, 5.241F, 0.7541F, 6.0F, 2.0F, 2.0F, 0.0F, false);
    }
    
    public void func_225598_a_(MatrixStack matrixStack, IVertexBuilder buffer, int packedLight, int packedOverlay, float red, float green, float blue, float alpha) {
      this.Head.func_228308_a_(matrixStack, buffer, packedLight, packedOverlay);
      this.Body.func_228308_a_(matrixStack, buffer, packedLight, packedOverlay);
    }
    
    public void setRotationAngle(ModelRenderer modelRenderer, float x, float y, float z) {
      modelRenderer.field_78795_f = x;
      modelRenderer.field_78796_g = y;
      modelRenderer.field_78808_h = z;
    }
    
    public void func_225597_a_(Entity e, float f, float f1, float f2, float f3, float f4) {}
  }
}

 

package tld.sullysmod.modid.procedures;

import java.util.Map;
import net.minecraft.entity.Entity;
import net.minecraft.entity.ILivingEntityData;
import net.minecraft.entity.MobEntity;
import net.minecraft.entity.SpawnReason;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IWorld;
import tld.sullysmod.modid.SullysModModElements;
import tld.sullysmod.modid.SullysModModElements.ModElement.Tag;
import tld.sullysmod.modid.entity.AngryWitherEntity;

@Tag
public class BabyWitherPlayerCollidesWithThisEntityProcedure extends SullysModModElements.ModElement {
  public BabyWitherPlayerCollidesWithThisEntityProcedure(SullysModModElements instance) {
    super(instance, 8);
  }
  
  public static void executeProcedure(Map<String, Object> dependencies) {
    if (dependencies.get("entity") == null) {
      System.err.println("Failed to load dependency entity for procedure BabyWitherPlayerCollidesWithThisEntity!");
      return;
    } 
    if (dependencies.get("x") == null) {
      System.err.println("Failed to load dependency x for procedure BabyWitherPlayerCollidesWithThisEntity!");
      return;
    } 
    if (dependencies.get("y") == null) {
      System.err.println("Failed to load dependency y for procedure BabyWitherPlayerCollidesWithThisEntity!");
      return;
    } 
    if (dependencies.get("z") == null) {
      System.err.println("Failed to load dependency z for procedure BabyWitherPlayerCollidesWithThisEntity!");
      return;
    } 
    if (dependencies.get("world") == null) {
      System.err.println("Failed to load dependency world for procedure BabyWitherPlayerCollidesWithThisEntity!");
      return;
    } 
    Entity entity = (Entity)dependencies.get("entity");
    double x = (dependencies.get("x") instanceof Integer) ? ((Integer)dependencies.get("x")).intValue() : ((Double)dependencies.get("x")).doubleValue();
    double y = (dependencies.get("y") instanceof Integer) ? ((Integer)dependencies.get("y")).intValue() : ((Double)dependencies.get("y")).doubleValue();
    double z = (dependencies.get("z") instanceof Integer) ? ((Integer)dependencies.get("z")).intValue() : ((Double)dependencies.get("z")).doubleValue();
    IWorld world = (IWorld)dependencies.get("world");
    if (!entity.field_70170_p.field_72995_K)
      entity.func_70106_y(); 
    if (world instanceof net.minecraft.world.World && !(world.func_201672_e()).field_72995_K) {
      AngryWitherEntity.CustomEntity customEntity = new AngryWitherEntity.CustomEntity(AngryWitherEntity.entity, world.func_201672_e());
      customEntity.func_70012_b(x, y, z, world.func_201674_k().nextFloat() * 360.0F, 0.0F);
      if (customEntity instanceof MobEntity)
        ((MobEntity)customEntity).func_213386_a(world, world.func_175649_E(new BlockPos((Entity)customEntity)), SpawnReason.MOB_SUMMONED, (ILivingEntityData)null, (CompoundNBT)null); 
      world.func_217376_c((Entity)customEntity);
    } 
  }
}

Thanks.

Link to comment
Share on other sites

Oh yeah. Right. I'm making a Witherling and porting it to 1.17.

 

According to Sully's Mod. The description for it says:

Witherlings are rare Nether-mobs that pretty much act like a weaker Wither that can't shoot as far and doesn't do much damage, they drop Wither Rozes when they die.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

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