Added new brews.

This commit is contained in:
Lizbeth Rika committed 2015-01-25 22:21:51 +00:00
1 parent b8e4bbab4e
commit 133f696c66
17 files changed
+197 -153

No files matched your search

@@ -32,15 +32,12 @@ public class ModBrews {
public static Brew nightVision;
public static Brew absorption;
public static Brew allure;
public static Brew soulCross;
public static Brew featherfeet;
public static Brew emptiness;
public static Brew fulfilment;
public static Brew livingReactor;
public static Brew bloodthirst;
public static Brew overload;
public static Brew manashock;
public static Brew gravitation;
public static Brew cleansing;
public static Brew warpWard;
@@ -59,15 +56,12 @@ public class ModBrews {
nightVision = new BrewMod(LibBrewNames.NIGHT_VISION, 0x7C4BEB, 4000, new PotionEffect(Potion.nightVision.id, 9600, 0));
absorption = new BrewMod(LibBrewNames.ABSORPTION, 0xF2EB23, 7000, new PotionEffect(Potion.field_76444_x.id, 1800, 3)).setNotBloodPendantInfusable();
/*soulCross = new BrewModPotion(LibBrewNames.SOUL_CROSS, 10000, new PotionEffect(ModPotions.soulCross.id, 1800, 0));
overload = new BrewMod(LibBrewNames.OVERLOAD, 0x232323, 12000, new PotionEffect(Potion.damageBoost.id, 1800, 3), new PotionEffect(Potion.moveSpeed.id, 1800, 2), new PotionEffect(Potion.weakness.id, 1800, 2), new PotionEffect(Potion.hunger.id, 200, 2));
soulCross = new BrewModPotion(LibBrewNames.SOUL_CROSS, 10000, new PotionEffect(ModPotions.soulCross.id, 1800, 0));
featherfeet = new BrewModPotion(LibBrewNames.FEATHER_FEET, 7000, new PotionEffect(ModPotions.featherfeet.id, 1800, 0));
emptiness = new BrewModPotion(LibBrewNames.EMPTINESS, 30000, new PotionEffect(ModPotions.emptiness.id, 7200, 0));
fulfilment = new BrewModPotion(LibBrewNames.FULFILMENT, 20000, new PotionEffect(ModPotions.fulfilment.id, 7200, 0));
livingReactor = new BrewModPotion(LibBrewNames.LIVING_REACTOR, 9000, new PotionEffect(ModPotions.livingReactor.id, 200, 0));
overload = new BrewMod(LibBrewNames.OVERLOAD, 0x232323, 12000, new PotionEffect(Potion.damageBoost.id, 1800, 3), new PotionEffect(Potion.moveSpeed.id, 1800, 2), new PotionEffect(Potion.weakness.id, 1800, 2), new PotionEffect(Potion.hunger.id, 200, 0));
manashock = new BrewModPotion(LibBrewNames.MANASHOCK, 15000, new PotionEffect(ModPotions.manashock.id, 200, 0));
gravitation = new BrewModPotion(LibBrewNames.MANASHOCK, 12000, new PotionEffect(ModPotions.gravitation.id, 1800, 0));
cleansing = new BrewModPotion(LibBrewNames.CLEANSING, 16000, new PotionEffect(ModPotions.cleansing.id, 1200, 0));*/
bloodthirst = new BrewModPotion(LibBrewNames.BLOODTHIRST, 20000, new PotionEffect(ModPotions.bloodthrst.id, 7200, 0));
allure = new BrewModPotion(LibBrewNames.ALLURE, 2000, new PotionEffect(ModPotions.allure.id, 4800, 0));
}
public static void initTC() {
@@ -11,31 +11,56 @@
*/
package vazkii.botania.common.brew;
import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import net.minecraft.potion.Potion;
import vazkii.botania.common.brew.potion.PotionAllure;
import vazkii.botania.common.brew.potion.PotionBloodthirst;
import vazkii.botania.common.brew.potion.PotionEmptiness;
import vazkii.botania.common.brew.potion.PotionFeatherfeet;
import vazkii.botania.common.brew.potion.PotionSoulCross;
public class ModPotions {
public static Potion soulCross;
public static Potion featherfeet;
public static Potion emptiness;
public static Potion fulfilment;
public static Potion livingReactor;
public static Potion manashock;
public static Potion gravitation;
public static Potion cleansing;
public static Potion bloodthrst;
public static Potion allure;
public static void init() {
/*if(Potion.potionTypes.length < 256)
if(Potion.potionTypes.length < 256)
extendPotionArray();
soulCross = new PotionSoulCross();
featherfeet = new PotionFeatherfeet();
emptiness = new PotionEmptiness();
fulfilment = new PotionFulfilment();
livingReactor = new PotionLivingReactor();
manashock = new PotionManashock();
gravitation = new PotionGravitation();
cleansing = new PotionCleansing();*/
bloodthrst = new PotionBloodthirst();
allure = new PotionAllure();
}
private static void extendPotionArray() {
Potion[] potionTypes = null;
for (Field f : Potion.class.getDeclaredFields()) {
f.setAccessible(true);
try {
if (f.getName().equals("potionTypes") || f.getName().equals("field_76425_a")) {
Field modfield = Field.class.getDeclaredField("modifiers");
modfield.setAccessible(true);
modfield.setInt(f, f.getModifiers() & ~Modifier.FINAL);
potionTypes = (Potion[])f.get(null);
final Potion[] newPotionTypes = new Potion[256];
System.arraycopy(potionTypes, 0, newPotionTypes, 0, potionTypes.length);
f.set(null, newPotionTypes);
}
} catch (Exception e) {
System.err.println("Severe error, please report this to the mod author:");
System.err.println(e);
}
}
}
}
@@ -0,0 +1,39 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:15:09 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityFishHook;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionAllure extends PotionMod {
public PotionAllure() {
super(LibPotionNames.ALLURE, false, 0x0034E4, 5);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
EntityLivingBase e = event.entityLiving;
if(e instanceof EntityPlayer && hasEffect(e)) {
EntityFishHook hook = ((EntityPlayer) e).fishEntity;
if(hook != null)
hook.onUpdate();
}
}
}
@@ -0,0 +1,47 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:13:09 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import java.util.List;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import vazkii.botania.common.brew.ModPotions;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionBloodthirst extends PotionMod {
private static final int RANGE = 64;
public PotionBloodthirst() {
super(LibPotionNames.BLOODTHIRST, false, 0xC30000, 3);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
for(EntityPlayer player : players)
if(hasEffect(player) && !hasEffect(player, ModPotions.emptiness)) {
event.setResult(Result.ALLOW);
return;
}
}
}
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:17:08 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionCleansing extends PotionMod {
public PotionCleansing() {
super(LibPotionNames.CLEANSING, false, 0xFF2B94, 7);
}
}
@@ -11,12 +11,36 @@
*/
package vazkii.botania.common.brew.potion;
import java.util.List;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import vazkii.botania.common.lib.LibPotionNames;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PotionEmptiness extends PotionMod {
private static final int RANGE = 128;
public PotionEmptiness() {
super(LibPotionNames.EMPTINESS, false, 0xE7E7E7, 2);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onSpawn(LivingSpawnEvent.CheckSpawn event) {
if(event.getResult() != Result.ALLOW && event.entityLiving instanceof IMob) {
List<EntityPlayer> players = event.world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(event.x - RANGE, event.y - RANGE, event.z - RANGE, event.x + RANGE, event.y + RANGE, event.z + RANGE));
for(EntityPlayer player : players)
if(hasEffect(player)) {
event.setResult(Result.DENY);
return;
}
}
}
}
@@ -11,12 +11,24 @@
*/
package vazkii.botania.common.brew.potion;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import vazkii.botania.common.lib.LibPotionNames;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PotionFeatherfeet extends PotionMod {
public PotionFeatherfeet() {
super(LibPotionNames.FEATHER_FEET, false, 0x26ADFF, 1);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onEntityUpdate(LivingUpdateEvent event) {
EntityLivingBase e = event.entityLiving;
if(hasEffect(e))
e.fallDistance = 0F;
}
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:13:09 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionFulfilment extends PotionMod {
public PotionFulfilment() {
super(LibPotionNames.FULFILMENT, false, 0xF4C4AE, 3);
}
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:16:43 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionGravitation extends PotionMod {
public PotionGravitation() {
super(LibPotionNames.GRAVITATION, false, 0x6000FF, 6);
}
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:14:00 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionLivingReactor extends PotionMod {
public PotionLivingReactor() {
super(LibPotionNames.LIVING_REACTOR, false, 0x0FB662, 4);
}
}
@@ -1,22 +0,0 @@
/**
* This class was created by <Vazkii>. It's distributed as
* part of the Botania Mod. Get the Source Code in github:
* https://github.com/Vazkii/Botania
*
* Botania is Open Source and distributed under a
* Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License
* (http://creativecommons.org/licenses/by-nc-sa/3.0/deed.en_GB)
*
* File Created @ [Nov 3, 2014, 12:15:09 AM (GMT)]
*/
package vazkii.botania.common.brew.potion;
import vazkii.botania.common.lib.LibPotionNames;
public class PotionManashock extends PotionMod {
public PotionManashock() {
super(LibPotionNames.MANASHOCK, false, 0x0034E4, 5);
}
}
@@ -12,6 +12,7 @@
package vazkii.botania.common.brew.potion;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.util.ResourceLocation;
import vazkii.botania.client.lib.LibResources;
@@ -43,5 +44,13 @@ public class PotionMod extends Potion {
return super.getStatusIconIndex();
}
public boolean hasEffect(EntityLivingBase entity) {
return hasEffect(entity, this);
}
public boolean hasEffect(EntityLivingBase entity, Potion potion) {
return entity.getActivePotionEffect(potion) != null;
}
}
@@ -11,12 +11,28 @@
*/
package vazkii.botania.common.brew.potion;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import vazkii.botania.common.lib.LibPotionNames;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class PotionSoulCross extends PotionMod {
public PotionSoulCross() {
super(LibPotionNames.SOUL_CROSS, false, 0x47453d, 0);
MinecraftForge.EVENT_BUS.register(this);
}
@SubscribeEvent
public void onEntityKill(LivingDeathEvent event) {
Entity e = event.source.getEntity();
if(e != null && e instanceof EntityLivingBase) {
EntityLivingBase living = (EntityLivingBase) e;
if(hasEffect(living))
living.heal(event.entityLiving.getMaxHealth() / 20);
}
}
}
@@ -30,12 +30,9 @@ public final class LibBrewNames {
public static final String SOUL_CROSS = "soulCross";
public static final String FEATHER_FEET = "featherFeet";
public static final String EMPTINESS = "emptiness";
public static final String FULFILMENT = "fulfilment";
public static final String LIVING_REACTOR = "livingReactor";
public static final String BLOODTHIRST = "bloodthirst";
public static final String OVERLOAD = "overload";
public static final String MANASHOCK = "manashock";
public static final String GRAVITATION = "gravitation";
public static final String CLEANSING = "cleansing";
public static final String ALLURE = "allure";
public static final String WARP_WARD = "warpWard";
@@ -16,10 +16,7 @@ public final class LibPotionNames {
public static final String SOUL_CROSS = "soulCross";
public static final String FEATHER_FEET = "featherFeet";
public static final String EMPTINESS = "emptiness";
public static final String FULFILMENT = "fulfilment";
public static final String LIVING_REACTOR = "livingReactor";
public static final String MANASHOCK = "manashock";
public static final String GRAVITATION = "gravitation";
public static final String CLEANSING = "cleansing";
public static final String BLOODTHIRST = "bloodthirst";
public static final String ALLURE = "allure";
}