Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //TODO: NEW ICON FOR SPIRITUAL_WARD
- public static final EnumGolemTrait SPIRITUAL_WARD = EnumHelper.addEnum(EnumGolemTrait.class, "SPIRITUAL_WARD", new Class[]{ResourceLocation.class}, new ResourceLocation(Bewitchment.MODID, "textures/thaumcraft/golems/tag_blessed.png"));
- public static final EnumGolemTrait UNCANNY = EnumHelper.addEnum(EnumGolemTrait.class, "UNCANNY", new Class[]{ResourceLocation.class}, new ResourceLocation(Bewitchment.MODID, "textures/thaumcraft/golems/tag_uncanny.png"));
- public static final EnumGolemTrait BLESSED = EnumHelper.addEnum(EnumGolemTrait.class, "BLESSED", new Class[]{ResourceLocation.class}, new ResourceLocation(Bewitchment.MODID, "textures/thaumcraft/golems/tag_blessed.png"));
- public static void init() {
- ThaumcraftApi.registerResearchLocation(new ResourceLocation(Bewitchment.MODID, "tc/research/bewitchment"));
- ScanningManager.addScannableThing(new ScanOreDictionary("f_MATCOLDIRON", new String[]{"ingotColdIron", "blockColdIron", "nuggetColdIron"}));
- ScanningManager.addScannableThing(new ScanOreDictionary("f_MATDRAGONSBLOOD", new String[]{"resinDragonsBlood", "blockDragonsBloodResin"}));
- ScanningManager.addScannableThing(new ScanOreDictionary("f_MATSILVER", new String[]{"ingotSilver", "blockSilver", "plateSilver", "dustSilver", "nuggetSilver", "oreSilver"}));
- GolemMaterial.register(new GolemMaterial("COLDIRON", new String[]{"MATSTUDCOLDIRON"}, new ResourceLocation("bewitchment", "textures/entity/coldirongolem.png"), 2699070, 20, 8, 3, new ItemStack(ModObjects.cold_iron_plate), new ItemStack(ItemsTC.mechanismSimple), new EnumGolemTrait[]{EnumGolemTrait.HEAVY, EnumGolemTrait.FIREPROOF, EnumGolemTrait.BLASTPROOF, SPIRITUAL_WARD}));
- GolemMaterial.register(new GolemMaterial("DRAGONSBLOOD", new String[]{"MATSTUDDRAGONSBLOOD"}, new ResourceLocation("bewitchment", "textures/entity/dragonsbloodgolem.png"), 4786944, 10, 1, 1, new ItemStack(ModObjects.dragons_blood_resin), new ItemStack(ItemsTC.mechanismSimple), new EnumGolemTrait[]{EnumGolemTrait.FRAGILE, EnumGolemTrait.CLUMSY, EnumGolemTrait.LIGHT, UNCANNY}));
- GolemMaterial.register(new GolemMaterial("SILVER", new String[]{"MATSTUDSILVER"}, new ResourceLocation("bewitchment", "textures/entity/silvergolem.png"), 10922156, 14, 3, 2, new ItemStack(ModObjects.silver_plate), new ItemStack(ItemsTC.mechanismSimple), new EnumGolemTrait[]{EnumGolemTrait.LIGHT, BLESSED}));
- }
- private static Aspect getOrCreateAspect(String tag, int color, Aspect[] components, ResourceLocation image) {
- Aspect a = Aspect.getAspect(tag);
- if (a != null) return a;
- return new Aspect(tag, color, components, image, 1);
- }
- public static boolean isColdIronGolem(EntityLivingBase golem) {
- return golem instanceof EntityThaumcraftGolem && ((EntityThaumcraftGolem) golem).getProperties().hasTrait(SPIRITUAL_WARD);
- }
- public static boolean isSilverGolem(EntityLivingBase golem) {
- return golem instanceof EntityThaumcraftGolem && ((EntityThaumcraftGolem) golem).getProperties().hasTrait(BLESSED);
- }
- public static boolean isDragonsBloodGolem(EntityLivingBase golem) {
- return golem instanceof EntityThaumcraftGolem && ((EntityThaumcraftGolem) golem).getProperties().hasTrait(UNCANNY);
- }
- //Todo: Apply slowness to all mobs attacked by this + make mobs flee it's presence.
- @SubscribeEvent
- public void handleDragonsBloodGolems(LivingHurtEvent event) {
- EntityLivingBase entity = event.getEntityLiving();
- if (!entity.world.isRemote) {
- Entity source = event.getSource().getImmediateSource();
- if (source instanceof EntityLivingBase && isDragonsBloodGolem((EntityLivingBase) source)) {
- entity.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 600, 0));
- }
- }
- }
- @SubscribeEvent
- public void handleDragonsBloodGolems(LivingEvent.LivingUpdateEvent event) {
- if (isDragonsBloodGolem(event.getEntityLiving()) && event.getEntityLiving().getRNG().nextInt(20) == 0) {
- EntityThaumcraftGolem golem = (EntityThaumcraftGolem) event.getEntityLiving();
- List<EntityMob> mobsNearby = golem.world.getEntitiesWithinAABB(EntityMob.class, golem.getEntityBoundingBox().grow(8));
- mobsNearby.forEach(mob -> {
- Vec3d vec3d = RandomPositionGenerator.findRandomTargetBlockAwayFrom(golem, 16, 7, new Vec3d(mob.posX, mob.posY, mob.posZ));
- if (vec3d != null && mob.getDistanceSq(vec3d.x, vec3d.y, vec3d.z) >= mob.getDistanceSq(golem)) {
- Path path = mob.getNavigator().getPathToXYZ(vec3d.x, vec3d.y, vec3d.z);
- if (path != null) mob.getNavigator().setPath(path, 1);
- }
- });
- }
- }
- @SubscribeEvent
- public void handleSilverGolem(LivingHurtEvent event) {
- EntityLivingBase entity = event.getEntityLiving();
- if (!entity.world.isRemote) {
- Entity source = event.getSource().getImmediateSource();
- if (source instanceof EntityLivingBase) {
- float weakness = BewitchmentAPI.getSilverWeakness(entity);
- if (weakness > 1 && isSilverGolem((EntityLivingBase) source)) event.setAmount(event.getAmount() * weakness * 2);
- weakness = BewitchmentAPI.getSilverWeakness((EntityLivingBase) source);
- if (weakness > 1 && isSilverGolem(entity)) {
- event.setAmount(event.getAmount() * 0.4F);
- source.attackEntityFrom(DamageSource.causeThornsDamage(entity), 4);
- }
- }
- }
- }
- @SubscribeEvent
- public void handleColdIronGolems(LivingHurtEvent event) {
- EntityLivingBase entity = event.getEntityLiving();
- if (!entity.world.isRemote) {
- Entity source = event.getSource().getImmediateSource();
- if (source instanceof EntityLivingBase) {
- float weakness = BewitchmentAPI.getColdIronWeakness(entity);
- if (weakness > 1 && isColdIronGolem((EntityLivingBase) source)) event.setAmount(event.getAmount() * weakness * 2);
- weakness = BewitchmentAPI.getColdIronWeakness((EntityLivingBase) source);
- if (weakness > 1 && isColdIronGolem(entity)) {
- event.setAmount(event.getAmount() * 0.4F);
- source.attackEntityFrom(DamageSource.causeThornsDamage(entity), 4);
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment