forked from MobiusFlip/CrimsonRevelations
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
96f5bf7
commit 3ba31ad
Showing
7 changed files
with
152 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
src/main/java/com/mobiusflip/crimsonrevelations/init/ResearchHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
97 changes: 97 additions & 0 deletions
97
src/main/java/com/mobiusflip/crimsonrevelations/item/foci/FocusEffectPoison.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters