Skip to content

Commit

Permalink
Taintacle Boss
Browse files Browse the repository at this point in the history
WIP
  • Loading branch information
IcarussOne committed May 19, 2024
1 parent 4806584 commit 6ab694d
Show file tree
Hide file tree
Showing 15 changed files with 392 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import com.mobiusflip.crimsonrevelations.compat.CompatHandler;
import com.mobiusflip.crimsonrevelations.init.CRCreativeTabs;
import com.mobiusflip.crimsonrevelations.init.RenderingHandler;
import com.mobiusflip.crimsonrevelations.init.ResearchHandler;

@Mod(modid = CrimsonRevelations.MODID, name = CrimsonRevelations.NAME, version = CrimsonRevelations.VERSION, dependencies = CrimsonRevelations.DEPENDENCIES)
Expand All @@ -19,17 +20,21 @@ public class CrimsonRevelations {
public static final String DEPENDENCIES = "required-after:thaumcraft@[1.12.2-6.1.BETA26,);after:thaumicaugmentation";
public static final CreativeTabs tabCR = new CRCreativeTabs(CreativeTabs.CREATIVE_TAB_ARRAY.length, "CrimsonRevelationsTab");

@Mod.Instance
public static CrimsonRevelations instance;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
RenderingHandler.preInit();
}

@EventHandler
public void init(FMLInitializationEvent event) {
CompatHandler.init();
ResearchHandler.init();
}

@EventHandler
public void postinit(FMLPostInitializationEvent event) {
CompatHandler.init();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.mobiusflip.crimsonrevelations.client.renderer;

import com.mobiusflip.crimsonrevelations.CrimsonRevelations;
import com.mobiusflip.crimsonrevelations.entity.boss.EntityOvergrownTaintacle;

import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.client.renderer.entity.RenderManager;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import thaumcraft.client.renderers.models.entity.ModelTaintacle;

@SideOnly(Side.CLIENT)
public class RenderOvergrownTaintacle extends RenderLiving<EntityOvergrownTaintacle> {
public static final ResourceLocation TEXTURES = new ResourceLocation(CrimsonRevelations.MODID, "textures/entity/overgrown_taintacle.png");

public RenderOvergrownTaintacle(RenderManager renderManager) {
super(renderManager, new ModelTaintacle(12, false), 0.8F);
}

@Override
protected ResourceLocation getEntityTexture(EntityOvergrownTaintacle entity) {
return TEXTURES;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
package com.mobiusflip.crimsonrevelations.entity.boss;

import net.minecraftforge.event.ForgeEventFactory;

import javax.annotation.Nullable;

import com.mobiusflip.crimsonrevelations.init.LootTableHandler;

import net.minecraft.entity.IEntityLivingData;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.IAttributeInstance;
import net.minecraft.entity.item.EntityXPOrb;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.world.BossInfo;
import net.minecraft.world.BossInfoServer;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.World;
import net.minecraft.util.ResourceLocation;
import thaumcraft.api.ThaumcraftApiHelper;
import thaumcraft.api.entities.ITaintedMob;
import thaumcraft.client.fx.FXDispatcher;
import thaumcraft.common.entities.monster.mods.ChampionModifier;
import thaumcraft.common.entities.monster.tainted.EntityTaintacle;
import thaumcraft.common.lib.SoundsTC;
import thaumcraft.common.lib.utils.EntityUtils;

public class EntityOvergrownTaintacle extends EntityTaintacle implements ITaintedMob {
protected final BossInfoServer bossInfo;

public EntityOvergrownTaintacle(World world) {
super(world);
this.bossInfo = new BossInfoServer(this.getDisplayName(), BossInfo.Color.PINK, BossInfo.Overlay.PROGRESS);
this.setSize(1.0F, 5.5F);
this.experienceValue = 50;
}

@Override
protected void applyEntityAttributes() {
super.applyEntityAttributes();
this.getEntityAttribute(SharedMonsterAttributes.ARMOR).setBaseValue(8.0D);
this.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).setBaseValue(9.0D);
this.getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).setBaseValue(175.0D);
this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).setBaseValue(1.0D);
}

@Override
protected void updateAITasks() {
super.updateAITasks();
this.bossInfo.setPercent(this.getHealth() / this.getMaxHealth());
}

@Override
public void removeTrackingPlayer(final EntityPlayerMP player) {
super.removeTrackingPlayer(player);
this.bossInfo.removePlayer(player);
}

@Override
public void addTrackingPlayer(final EntityPlayerMP player) {
super.addTrackingPlayer(player);
this.bossInfo.addPlayer(player);
}

// Fixes it spawning with lower health
protected void makeChampion() {
if (getEntityAttribute(ThaumcraftApiHelper.CHAMPION_MOD).getAttributeValue() > -2.0) return;

int type = rand.nextInt(ChampionModifier.mods.length);
IAttributeInstance mod = getEntityAttribute(ThaumcraftApiHelper.CHAMPION_MOD);
mod.removeModifier(ChampionModifier.mods[type].attributeMod);
mod.applyModifier(ChampionModifier.mods[type].attributeMod);

IAttributeInstance health = getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH);
health.removeModifier(EntityUtils.CHAMPION_HEALTH);
health.applyModifier(EntityUtils.CHAMPION_HEALTH);

IAttributeInstance attackDamage = getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE);
attackDamage.removeModifier(EntityUtils.CHAMPION_DAMAGE);
attackDamage.applyModifier(EntityUtils.CHAMPION_DAMAGE);

setHealth(getMaxHealth());
setCustomNameTag(ChampionModifier.mods[type].getModNameLocalized() + " " + getName());
enablePersistence();
switch (type) {
// Bold
case 0: {
IAttributeInstance movementSpeed = getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED);
movementSpeed.removeModifier(EntityUtils.BOLDBUFF);
movementSpeed.applyModifier(EntityUtils.BOLDBUFF);
break;
}

// Mighty
case 3: {
attackDamage.removeModifier(EntityUtils.MIGHTYBUFF);
attackDamage.applyModifier(EntityUtils.MIGHTYBUFF);
break;
}

// Warded
case 5: {
int warding = (int) (getEntityAttribute(SharedMonsterAttributes.MAX_HEALTH).getBaseValue() / 2.0);
setAbsorptionAmount(getAbsorptionAmount() + warding);
break;
}

default:
break;
}
}

@Override
public boolean canBreatheUnderwater() {
return true;
}

@Override
public boolean canBePushed() {
return false;
}

@Override
protected int decreaseAirSupply(int air) {
return air;
}

@Override
public void setInWeb() {
}

@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance diff, @Nullable IEntityLivingData data) {
this.makeChampion();
this.bossInfo.setName(this.getDisplayName());
return super.onInitialSpawn(diff, data);
}

public boolean isNonBoss() {
return false;
}

// Special taint death animation
@Override
protected void onDeathUpdate() {
if (!this.world.isRemote && (this.isPlayer() || this.recentlyHit > 0 && this.canDropLoot() && this.world.getGameRules().getBoolean("doMobLoot"))) {
int i = this.getExperiencePoints(this.attackingPlayer);
i = ForgeEventFactory.getExperienceDrop(this, this.attackingPlayer, i);

while (i > 0) {
int j = EntityXPOrb.getXPSplit(i);
i -= j;
this.world.spawnEntity(new EntityXPOrb(this.world, this.posX, this.posY, this.posZ, j));
}
}

this.setDead();
this.playSound(SoundsTC.gore, 1.0F, 0.65F / (rand.nextFloat() * 0.4F + 0.8F));

for (int k = 0; k < 40; ++k) {
FXDispatcher.INSTANCE.splooshFX(this);
FXDispatcher.INSTANCE.taintsplosionFX(this);
}
}

@Override
@Nullable
protected ResourceLocation getLootTable() {
return LootTableHandler.OVERGROWN_TAINTACLE;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@
@EventBusSubscriber(modid = CrimsonRevelations.MODID)
public class LootTableHandler {
public static final ResourceLocation CULTIST = new ResourceLocation(CrimsonRevelations.MODID, ("entities/cultist"));


// Bosses
public static final ResourceLocation OVERGROWN_TAINTACLE = new ResourceLocation(CrimsonRevelations.MODID, ("entities/boss/overgrown_taintacle"));

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onLootTableLoad(LootTableLoadEvent event) {
if (event.getName().equals(new ResourceLocation(Thaumcraft.MODID, "cultist"))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

public class RecipeHandler {
public static void initArcaneCrafting() {
// defaultGroup is meant for recipe books and is not really needed here.
// defaultGroup is meant for recipe books and is not really needed here.
ResourceLocation defaultGroup = new ResourceLocation("");

ThaumcraftApi.addArcaneCraftingRecipe(new ResourceLocation("crimsonrevelations", "crimsonbanner"), new ShapedArcaneRecipe(
Expand Down Expand Up @@ -144,7 +144,7 @@ public static void initCrucible() {

ThaumcraftApi.addCrucibleRecipe(new ResourceLocation("crimsonrevelations", "orderquartz"),
new CrucibleRecipe("ORDERED_DECONSTRUCTION", new ItemStack(Items.QUARTZ, 4, 0), "blockQuartz", new AspectList().add(Aspect.ORDER, 25)));

ThaumcraftApi.addCrucibleRecipe(new ResourceLocation("crimsonrevelations", "ordersandstone"),
new CrucibleRecipe("ORDERED_DECONSTRUCTION", new ItemStack(Blocks.SAND, 4, 0), "sandstone", new AspectList().add(Aspect.ORDER, 25)));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@

import com.google.common.base.Preconditions;
import com.mobiusflip.crimsonrevelations.CrimsonRevelations;
import com.mobiusflip.crimsonrevelations.entity.boss.EntityOvergrownTaintacle;

import net.minecraft.block.Block;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockSlab;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.crafting.IRecipe;
Expand All @@ -18,12 +20,19 @@
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.EntityEntry;
import net.minecraftforge.fml.common.registry.EntityRegistry;
import net.minecraftforge.fml.common.registry.ForgeRegistries;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.IForgeRegistryEntry;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.aspects.AspectEventProxy;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.aspects.AspectRegistryEvent;

@SuppressWarnings("deprecation")
@EventBusSubscriber(modid = CrimsonRevelations.MODID)
Expand All @@ -49,6 +58,28 @@ public static void registerRecipes(RegistryEvent.Register<IRecipe> event) {
RecipeHandler.initInfusion();
}

@SubscribeEvent
public static void registerEntities(RegistryEvent.Register<EntityEntry> event) {
int id = 0;

entityRegistryHelper("overgrown_taintacle", EntityOvergrownTaintacle.class, id++, 64, 3, true, 0x1C1A2F, 0x5649B4);
}

@SubscribeEvent
public static void registerAspects(AspectRegistryEvent event) {
ThaumcraftApi.registerEntityTag(CrimsonRevelations.MODID + ".overgrown_taintacle", new AspectList().add(Aspect.FLUX, 30).add(Aspect.ELDRITCH, 30).add(Aspect.AVERSION, 30).add(Aspect.PLANT, 30));
}

public static void entityRegistryHelper(String name, Class<? extends Entity> clazz, int id, int trackingRange, int updateFrequency, boolean sendVelocityUpdates, int eggColor1, int eggColor2) {
EntityRegistry.registerModEntity(new ResourceLocation(CrimsonRevelations.MODID, name), clazz, CrimsonRevelations.MODID + "." + name, id, CrimsonRevelations.instance, trackingRange,
updateFrequency, sendVelocityUpdates, eggColor1, eggColor2);
}

public static void egglessEntityRegistryHelper(String name, Class<? extends Entity> clazz, int id, int trackingRange, int updateFrequency, boolean sendVelocityUpdates) {
EntityRegistry.registerModEntity(new ResourceLocation(CrimsonRevelations.MODID, name), clazz, CrimsonRevelations.MODID + "." + name, id, CrimsonRevelations.instance, trackingRange,
updateFrequency, sendVelocityUpdates);
}

@SubscribeEvent
public static void registerItemBlocks(RegistryEvent.Register<Item> event) {
final IForgeRegistry<Item> registry = event.getRegistry();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package com.mobiusflip.crimsonrevelations.init;

import com.mobiusflip.crimsonrevelations.client.renderer.RenderOvergrownTaintacle;
import com.mobiusflip.crimsonrevelations.entity.boss.EntityOvergrownTaintacle;

import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

@SideOnly(Side.CLIENT)
public class RenderingHandler {
public static void preInit() {
RenderingRegistry.registerEntityRenderingHandler(EntityOvergrownTaintacle.class, RenderOvergrownTaintacle::new);
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
package com.mobiusflip.crimsonrevelations.init;

import com.mobiusflip.crimsonrevelations.CrimsonRevelations;
import com.mobiusflip.crimsonrevelations.entity.boss.EntityOvergrownTaintacle;
import com.mobiusflip.crimsonrevelations.item.foci.FocusEffectPoison;

import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Loader;
import thaumcraft.Thaumcraft;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.casters.FocusEngine;
import thaumcraft.api.research.ResearchCategories;
import thaumcraft.api.research.ScanEntity;
import thaumcraft.api.research.ScanningManager;

public class ResearchHandler {
public static void init() {
// Focus Effects
FocusEngine.registerElement(FocusEffectPoison.class, new ResourceLocation(CrimsonRevelations.MODID, "textures/foci/poison.png"), 9039872);

// Research Categories
ResearchCategories.registerCategory("REVELATIONS", "CrimsonRites", new AspectList(), new ResourceLocation(Thaumcraft.MODID, "textures/items/crimson_rites.png"), new ResourceLocation(CrimsonRevelations.MODID, "textures/gui/research_background.jpg"), new ResourceLocation(Thaumcraft.MODID, "textures/gui/gui_research_back_over.png"));

// Researches
ThaumcraftApi.registerResearchLocation(new ResourceLocation(CrimsonRevelations.MODID, "research/revelations"));

// Focus Effects
FocusEngine.registerElement(FocusEffectPoison.class, new ResourceLocation(CrimsonRevelations.MODID, "textures/foci/poison.png"), 9039872);
if (Loader.isModLoaded("thaumicaugmentation"))
ThaumcraftApi.registerResearchLocation(new ResourceLocation(CrimsonRevelations.MODID, "research/compat/thaumic_augmentation"));

// Scanning
if (Loader.isModLoaded("thaumicaugmentation"))
ScanningManager.addScannableThing(new ScanEntity("!OVERGROWN_TAINTACLE", EntityOvergrownTaintacle.class, true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ public void renderParticleFX(World world, double posX, double posY, double posZ,
pp.setGravity(-0.2F);
pp.setMaxAge(7 + world.rand.nextInt(5));
pp.setAlphaF(0.7F);
pp.setSlowDown(0.75);
pp.setScale(new float[]{(float)(0.1F + world.rand.nextGaussian() * 0.2F), 2.0F});
pp.setSlowDown(0.75D);
pp.setScale(new float[]{(float) (0.1F + world.rand.nextGaussian() * 0.2F), 2.0F});
pp.setParticles(575, 8, 8);
pp.setRBGColorF(((color >> 16) & 0xFF) / 255.0F, ((color >> 8) & 0xFF) / 255.0F, (color & 0xFF) / 255.0F);
ParticleEngine.addEffect(world, pp);
Expand Down
Loading

0 comments on commit 6ab694d

Please sign in to comment.