Jump to content

Recommended Posts

Posted

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.

Posted

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.

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.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • hello i am wanting to know if anyone can help me with this crash happened when i tried to go to bed on server https://pastebin.com/CezfAbAh
    • I accidentally posted this in the ForgeGradle subforum, super sorry. I meant to post it in the regular modders forum. Hopefully it can still reach the right people!
    • I've been trying to make an addon mod for create, but setting up dependencies and trying to add the mod into my mod environment has proven a little difficult for me. Ive been searching this forum and I've seen problems that were close to mine but not exactly mine, searching the error output just yields  people having trouble with their own modid, not an addons. The error while loading Minecraft,  "mods.toml missing metadata of modid create" and  "The Mod File C:Users\user1\data\<mod>\build\resources\main has mods that were not found" My build.gradle file plugins { id 'eclipse' id 'idea' id 'maven-publish' id 'net.minecraftforge.gradle' version '[6.0,6.2)' id 'org.parchmentmc.librarian.forgegradle' version '1.+' } version = mod_version group = mod_group_id base { archivesName = mod_id } // Mojang ships Java 17 to end users in 1.18+, so your mod should target Java 17. java.toolchain.languageVersion = JavaLanguageVersion.of(17) println "Java: ${System.getProperty 'java.version'}, JVM: ${System.getProperty 'java.vm.version'} (${System.getProperty 'java.vendor'}), Arch: ${System.getProperty 'os.arch'}" minecraft { mappings channel: 'parchment', version: '2023.09.03-1.20.1' copyIdeResources = true runs { configureEach { workingDirectory project.file('run') property 'forge.logging.markers', 'REGISTRIES' property 'forge.logging.console.level', 'debug' property 'mixin.env.remapRefMap', 'true' property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg" mods { "${mod_id}" { source sourceSets.main } } } client { // ... mods { other_mod { // ... } // Configures the 'example' mod create { // Add a source set to a mod's sources source sourceSets.main // Merges this configuration and specifies whether to overwrite existing properties merge mods.other_mod, true } } } server { property 'forge.enabledGameTestNamespaces', mod_id args '--nogui' } // This run config launches GameTestServer and runs all registered gametests, then exits. // By default, the server will crash when no gametests are provided. // The gametest system is also enabled by default for other run configs under the /test command. gameTestServer { property 'forge.enabledGameTestNamespaces', mod_id } data { // example of overriding the workingDirectory set in configureEach above workingDirectory project.file('run-data') // Specify the modid for data generation, where to output the resulting resource, and where to look for existing resources. args '--mod', mod_id, '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/') } } } // Include resources generated by data generators. sourceSets.main.resources { srcDir 'src/generated/resources' } repositories { maven { url = 'https://maven.tterrag.com/' } } dependencies { // Specify the version of Minecraft to use. // Any artifact can be supplied so long as it has a "userdev" classifier artifact and is a compatible patcher artifact. // The "userdev" classifier will be requested and setup by ForgeGradle. // If the group id is "net.minecraft" and the artifact id is one of ["client", "server", "joined"], // then special handling is done to allow a setup of a vanilla dependency without the use of an external repository. minecraft "net.minecraftforge:forge:1.20.1-47.3.22" implementation fg.deobf("com.simibubi.create:create-${create_minecraft_version}:${create_version}:slim") { transitive = false } implementation fg.deobf("com.jozufozu.flywheel:flywheel-forge-${flywheel_minecraft_version}:${flywheel_version}") implementation fg.deobf("com.tterrag.registrate:Registrate:${registrate_version}") // Example mod dependency with JEI - using fg.deobf() ensures the dependency is remapped to your development mappings // The JEI API is declared for compile time use, while the full JEI artifact is used at runtime // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-common-api:${jei_version}") // compileOnly fg.deobf("mezz.jei:jei-${mc_version}-forge-api:${jei_version}") // runtimeOnly fg.deobf("mezz.jei:jei-${mc_version}-forge:${jei_version}") // Example mod dependency using a mod jar from ./libs with a flat dir repository // This maps to ./libs/coolmod-${mc_version}-${coolmod_version}.jar // The group id is ignored when searching -- in this case, it is "blank" // implementation fg.deobf("blank:coolmod-${mc_version}:${coolmod_version}") // For more info: // http://www.gradle.org/docs/current/userguide/artifact_dependencies_tutorial.html // http://www.gradle.org/docs/current/userguide/dependency_management.html } // This block of code expands all declared replace properties in the specified resource targets. // A missing property will result in an error. Properties are expanded using ${} Groovy notation. // When "copyIdeResources" is enabled, this will also run before the game launches in IDE environments. // See https://docs.gradle.org/current/dsl/org.gradle.language.jvm.tasks.ProcessResources.html tasks.named('processResources', ProcessResources).configure { var replaceProperties = [ minecraft_version: minecraft_version, minecraft_version_range: minecraft_version_range, forge_version: forge_version, forge_version_range: forge_version_range, loader_version_range: loader_version_range, mod_id: mod_id, mod_name: mod_name, mod_license: mod_license, mod_version: mod_version, mod_authors: mod_authors, mod_description: mod_description, ] inputs.properties replaceProperties filesMatching(['META-INF/mods.toml', 'pack.mcmeta']) { expand replaceProperties + [project: project] } } // Example for how to get properties into the manifest for reading at runtime. tasks.named('jar', Jar).configure { manifest { attributes([ 'Specification-Title' : mod_id, 'Specification-Vendor' : mod_authors, 'Specification-Version' : '1', // We are version 1 of ourselves 'Implementation-Title' : project.name, 'Implementation-Version' : project.jar.archiveVersion, 'Implementation-Vendor' : mod_authors, 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ") ]) } // This is the preferred method to reobfuscate your jar file finalizedBy 'reobfJar' } // However if you are in a multi-project build, dev time needs unobfed jar files, so you can delay the obfuscation until publishing by doing: // tasks.named('publish').configure { // dependsOn 'reobfJar' // } // Example configuration to allow publishing using the maven-publish plugin publishing { publications { register('mavenJava', MavenPublication) { artifact jar } } } tasks.withType(JavaCompile).configureEach { options.encoding = 'UTF-8' // Use the UTF-8 charset for Java compilation } -And my mods.toml file  modLoader="javafml" #mandatory loaderVersion="[47,)" license="MIT" [[mods]] modId="mechmod" version="0.0.1" displayName="Create: Mechs" authors="Affe" [[dependencies.mechmod]] modId="create" mandatory=true versionRange="[0,)" ordering="NONE" side="BOTH" [[dependencies.mechmod]] modId="forge" mandatory=true versionRange="[47.1.3,)" ordering="NONE" side="BOTH" [[dependencies.mechmod]] modId="minecraft" mandatory=true versionRange="[1.20,1.21)" ordering="NONE" side="BOTH" [[dependencies.mechmod]] modId="flywheel" mandatory=true versionRange="[0.6.11,0.6.12)" ordering="AFTER" side="CLIENT" I thought I had implemented the code from the "depending on create" section from their github correctly. But I assume I haven't implemented something that is needed. But I don't know what or where. I can also provide any file you think will help with your diagnosis. Any help would be appreciated, cheers!   
    • Yo i might be a lil bit late but on 1.20.6 you can call BuiltInRegistries.ITEMS.getTagOrEmpty(*required tag*) to get an iterable of item holders, this might be possible on 1.18.2 as well. Then you get the items using for(Holder<Item> holder: iterable) or the .forEach(Consumer<Holder<Item>>) method, or convert the iterable to array/list/collection. When you get the holders, use the .get() method to get the items
    • I'm troubleshooting some mods that I want for a single player world in 1.21.4 and I was having trouble with a resource library config crashing my game so I tried another mod and the library config for that was causing crashes as well. I've updated java and forge recently. Both of these dependency mods have caused Exit Code: -1 but I'm using the crash report for the mod that I was originally wanting to use. https://pastebin.com/82FZPwS2
  • Topics

×
×
  • Create New...

Important Information

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