Skip to content

Commit

Permalink
Poison Focus Effect
Browse files Browse the repository at this point in the history
  • Loading branch information
IcarussOne committed May 17, 2024
1 parent 96f5bf7 commit 3ba31ad
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ public class CrimsonRevelations {

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

@EventHandler
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,22 @@
import com.mobiusflip.crimsonrevelations.CrimsonRevelations;

import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import thaumcraft.Thaumcraft;

@EventBusSubscriber(modid = CrimsonRevelations.MODID)
public class LootTableHandler {
public static final ResourceLocation CULTIST = new ResourceLocation(CrimsonRevelations.MODID, ("entities/cultist"));

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onLootTableLoad(LootTableLoadEvent event) {
if (event.getName().equals(new ResourceLocation(Thaumcraft.MODID, "cultist"))) {
LootTable lootCultist = event.getLootTableManager().getLootTableFromLocation(CULTIST);
event.getTable().addPool(lootCultist.getPool("crimson_material"));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,17 @@
import net.minecraft.item.ItemBlock;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.LootTable;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
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.Thaumcraft;

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

@SubscribeEvent(priority = EventPriority.LOWEST)
public static void onLootTableLoad(LootTableLoadEvent event) {
if (event.getName().equals(new ResourceLocation(Thaumcraft.MODID, "cultist"))) {
LootTable lootCultist = event.getLootTableManager().getLootTableFromLocation(LootTableHandler.CULTIST);
event.getTable().addPool(lootCultist.getPool("crimson_material"));
}
}

@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
@@ -1,16 +1,21 @@
package com.mobiusflip.crimsonrevelations.init;

import com.mobiusflip.crimsonrevelations.CrimsonRevelations;
import com.mobiusflip.crimsonrevelations.item.foci.FocusEffectPoison;

import net.minecraft.util.ResourceLocation;
import thaumcraft.Thaumcraft;
import thaumcraft.api.ThaumcraftApi;
import thaumcraft.api.aspects.AspectList;
import thaumcraft.api.casters.FocusEngine;
import thaumcraft.api.research.ResearchCategories;

public class ResearchHandler {
public static void init() {
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"));
ThaumcraftApi.registerResearchLocation(new ResourceLocation(CrimsonRevelations.MODID, "research/revelations"));

// Focus Effects
FocusEngine.registerElement(FocusEffectPoison.class, new ResourceLocation(CrimsonRevelations.MODID, "textures/foci/poison.png"), 9039872);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
package com.mobiusflip.crimsonrevelations.item.foci;

import com.mobiusflip.crimsonrevelations.CrimsonRevelations;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.MobEffects;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.SoundCategory;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World;
import net.minecraftforge.fml.common.network.NetworkRegistry;
import net.minecraftforge.fml.common.network.simpleimpl.IMessage;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import thaumcraft.api.aspects.Aspect;
import thaumcraft.api.casters.FocusEffect;
import thaumcraft.api.casters.NodeSetting;
import thaumcraft.api.casters.Trajectory;
import thaumcraft.client.fx.ParticleEngine;
import thaumcraft.client.fx.particles.FXGeneric;
import thaumcraft.common.lib.SoundsTC;
import thaumcraft.common.lib.network.PacketHandler;
import thaumcraft.common.lib.network.fx.PacketFXFocusPartImpact;

public class FocusEffectPoison extends FocusEffect {
@Override
public Aspect getAspect() {
return Aspect.ALCHEMY;
}

@Override
public String getKey() {
return "focus." + CrimsonRevelations.MODID + ".poison";
}

@Override
public NodeSetting[] createSettings() {
return new NodeSetting[]{new NodeSetting("power", "focus.common.power", (NodeSetting.INodeSettingType) new NodeSetting.NodeSettingIntRange(1, 5)), new NodeSetting("duration", "focus.common.double_duration", (NodeSetting.INodeSettingType) new NodeSetting.NodeSettingIntRange(2, 10))};
}

@Override
public int getComplexity() {
return this.getSettingValue("duration") + this.getSettingValue("power") * 2;
}

@Override
public float getDamageForDisplay(final float finalPower) {
return (2 + this.getSettingValue("power")) * finalPower;
}

@Override
public String getResearch() {
return "FOCUS_POISON";
}

@Override
public boolean execute(final RayTraceResult target, final Trajectory trajectory, final float finalPower, final int num) {
PacketHandler.INSTANCE.sendToAllAround((IMessage) new PacketFXFocusPartImpact(target.hitVec.x, target.hitVec.y, target.hitVec.z, new String[]{this.getKey()}), new NetworkRegistry.TargetPoint(this.getPackage().world.provider.getDimension(), target.hitVec.x, target.hitVec.y, target.hitVec.z, 64.0D));
this.getPackage().world.playSound((EntityPlayer) null, target.hitVec.x, target.hitVec.y, target.hitVec.z, SoundsTC.bubble, SoundCategory.PLAYERS, 0.33F, 5.0F + (float) (this.getPackage().world.rand.nextGaussian() * 0.05F));

if (target.typeOfHit == RayTraceResult.Type.ENTITY && target.entityHit != null) {
final float damage = this.getDamageForDisplay(finalPower);
final int duration = 40 * this.getSettingValue("duration");
final int potency = (int) (1.0F + this.getSettingValue("power") * finalPower / 3.0F);
target.entityHit.attackEntityFrom(DamageSource.causeThrownDamage((Entity) ((target.entityHit != null) ? target.entityHit : this.getPackage().getCaster()), (Entity) this.getPackage().getCaster()), damage);

if (target.entityHit instanceof EntityLivingBase) {
((EntityLivingBase) target.entityHit).addPotionEffect(new PotionEffect(MobEffects.POISON, duration, potency));
}
}

return false;
}

@Override
public void onCast(Entity caster) {
caster.world.playSound(null, caster.getPosition().up(), SoundsTC.bubble, SoundCategory.PLAYERS, 0.33F, 0.9F + caster.world.rand.nextFloat() * 0.1F);
}

@Override
@SideOnly(Side.CLIENT)
public void renderParticleFX(World world, double posX, double posY, double posZ, double velX, double velY, double velZ) {
final FXGeneric pp = new FXGeneric(world, posX, posY, posZ, velX, velY, velZ);
int color = 9039872;
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.setParticles(575, 8, 8);
pp.setRBGColorF(((color >> 16) & 0xFF) / 255.0F, ((color >> 8) & 0xFF) / 255.0F, (color & 0xFF) / 255.0F);
ParticleEngine.addEffect(world, pp);
}
}
8 changes: 8 additions & 0 deletions src/main/resources/assets/crimsonrevelations/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,11 @@ crimsonrevelations.research.ORDERED_DECONSTRUCTION.text.stage.1=While many simpl
crimsonrevelations.research.QUARTZ_PURIFICATION.title=Quartz Purification
crimsonrevelations.research.QUARTZ_PURIFICATION.text.stage.1=With my new knowledge of Ordo, it may be time to return to one of my earlier attempts with alchemy: native metal clusters. My experiments with most metals were successful, but although I know native quartz clusters can form, I haven't been able to recreate them in the same way. Perhaps examining other native clusters can provide me with some insight.
crimsonrevelations.research.QUARTZ_PURIFICATION.text.stage.2=The key insight proved deceptively simple: quartz is not a metal, and the Metallum usually present in my purifications must be replaced with Vitreus to account for its crystalline nature. The raw Ordo must be shaped slightly differently as well, but that proved to be trivial with the knowledge gained from studying erythurgy.<BR>Admittedly, the existence of the Fortune enchantment might make this process a bit underwhelming. Still, as a test of my abilities, it was quite interesting.

crimsonrevelations.research.FOCUS_POISON.title=Focus Effect: Poison
crimsonrevelations.research.FOCUS_POISON.stage.0=The poison inflicted from this blast of noxious goo lasts twice as long when compared to other effects.<BR>I must be wary however that a fair amount of monsters are resistant to being poisoned, such as the undead, spiders, and other rather fearsome opponents.

focus.crimsonrevelations.poison.name=Poison
focus.crimsonrevelations.poison.text=Summons a blob of goo at your target and poisons it for double the usual duration.

focus.common.double_duration=Duration (two seconds)
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,33 @@
]
}
]
},
{
"key": "FOCUS_POISON",
"name": "crimsonrevelations.research.FOCUS_POISON.title",
"icons": [
"focus:focus.crimsonrevelations.poison"
],
"category": "REVELATIONS",
"parents": [
"CRIMSON_REVELATIONS",
"FOCUSELEMENTAL"
],
"location": [
0,
-2
],
"stages": [
{
"text": "crimsonrevelations.research.FOCUS_POISON.stage.0",
"required_knowledge": [
"OBSERVATION;AUROMANCY;1"
],
"required_research": [
"!alkimia"
]
}
]
}
]
}

0 comments on commit 3ba31ad

Please sign in to comment.