Created all code necessary to summon the portal. I'm awesome, I know.

This commit is contained in:
WayofTime 2014-12-04 14:31:31 -05:00
parent 832ed15060
commit 9b0fa9b052
37 changed files with 915 additions and 89 deletions

View file

@ -75,9 +75,13 @@ import WayofTime.alchemicalWizardry.common.bloodAltarUpgrade.UpgradedAltars;
import WayofTime.alchemicalWizardry.common.book.BUEntries;
import WayofTime.alchemicalWizardry.common.compress.AdvancedCompressionHandler;
import WayofTime.alchemicalWizardry.common.compress.BaseCompressionHandler;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketAngel;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketMinorGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.DemonPacketRegistry;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonChest;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
@ -102,6 +106,7 @@ import WayofTime.alchemicalWizardry.common.items.sigil.SigilOfHolding;
import WayofTime.alchemicalWizardry.common.items.thaumcraft.ItemSanguineArmour;
import WayofTime.alchemicalWizardry.common.potion.PotionBoost;
import WayofTime.alchemicalWizardry.common.potion.PotionDeaf;
import WayofTime.alchemicalWizardry.common.potion.PotionDemonCloak;
import WayofTime.alchemicalWizardry.common.potion.PotionDrowning;
import WayofTime.alchemicalWizardry.common.potion.PotionFeatherFall;
import WayofTime.alchemicalWizardry.common.potion.PotionFireFuse;
@ -121,6 +126,7 @@ import WayofTime.alchemicalWizardry.common.rituals.RitualEffectAutoAlchemy;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectBiomeChanger;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectContainment;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectCrushing;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectDemonPortal;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEllipsoid;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectEvaporation;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectExpulsion;
@ -290,6 +296,7 @@ public class AlchemicalWizardry
public static Potion customPotionSoulHarden;
public static Potion customPotionDeaf;
public static Potion customPotionFeatherFall;
public static Potion customPotionDemonCloak;
public static int customPotionDrowningID;
public static int customPotionBoostID;
@ -306,6 +313,7 @@ public class AlchemicalWizardry
public static int customPotionSoulHardenID;
public static int customPotionDeafID;
public static int customPotionFeatherFallID;
public static int customPotionDemonCloakID;
public static boolean ritualDisabledWater;
public static boolean ritualDisabledLava;
@ -394,6 +402,10 @@ public class AlchemicalWizardry
public static String entityShadeElementalID = "AW013";
public static String entityHolyElementalID = "AW014";
public static String entityMinorDemonGruntID = "AW015";
public static String entityMinorDemonGruntFireID = "AW016";
public static String entityMinorDemonGruntWindID = "AW017";
public static String entityMinorDemonGruntIceID = "AW018";
public static String entityMinorDemonGruntEarthID = "AW019";
public static Fluid lifeEssenceFluid;
@ -681,6 +693,7 @@ public class AlchemicalWizardry
customPotionSoulHarden = (new PotionSoulHarden(customPotionSoulHardenID, false, 0).setIconIndex(0, 0).setPotionName("Soul Harden"));
customPotionDeaf = (new PotionDeaf(customPotionDeafID, true, 0).setIconIndex(0, 0).setPotionName("Deafness"));
customPotionFeatherFall = (new PotionFeatherFall(customPotionFeatherFallID, false, 0).setIconIndex(0, 0).setPotionName("Feather Fall"));
customPotionDemonCloak = (new PotionDemonCloak(customPotionDemonCloakID, false, 0).setIconIndex(0, 0).setPotionName("Demo Cloaking"));
ItemStack masterBloodOrbStack = new ItemStack(ModItems.masterBloodOrb);
@ -741,13 +754,14 @@ public class AlchemicalWizardry
this.initAlchemyPotionRecipes();
this.initAltarRecipes();
this.initRituals();
this.initBindingRecipes();
this.initHarvestRegistry();
this.initCombinedAlchemyPotionRecipes();
ReagentRegistry.initReagents();
this.initReagentRegistries();
this.initRituals();
this.initDemonPacketRegistiry();
this.initiateRegistry();
@ -851,6 +865,11 @@ public class AlchemicalWizardry
EntityRegistry.registerModEntity(EntityShadeElemental.class, "ShadeElemental", 32, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityHolyElemental.class, "HolyElemental", 33, this, 120, 3, true);
EntityRegistry.registerModEntity(EntityMinorDemonGrunt.class, "MinorDemonGrunt", 34, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityMinorDemonGruntFire.class, "MinorDemonGruntFire", 35, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityMinorDemonGruntWind.class, "MinorDemonGruntWind", 36, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityMinorDemonGruntIce.class, "MinorDemonGruntIce", 37, this, 80, 3, true);
EntityRegistry.registerModEntity(EntityMinorDemonGruntEarth.class, "MinorDemonGruntEarth", 38, this, 80, 3, true);
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.standardBindingAgent), 1, 3, this.standardBindingAgentDungeonChance));
ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST).addItem(new WeightedRandomChestContent(new ItemStack(ModItems.mundanePowerCatalyst), 1, 1, this.mundanePowerCatalystDungeonChance));
@ -1201,6 +1220,7 @@ public class AlchemicalWizardry
Rituals.registerRitual("AW028SpawnWard", 1, 150000, new RitualEffectSpawnWard(), "Ward of Sacrosanctity", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false));
Rituals.registerRitual("AW029VeilOfEvil", 1, 150000, new RitualEffectVeilOfEvil(), "Veil of Evil", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false));
Rituals.registerRitual("AW030FullStomach", 1, 100000, new RitualEffectFullStomach(), "Requiem of the Satiated Stomach", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/SimpleTransCircle.png"), 0, 0, 0, 255, 0, 0.501, 0.501, 0, 1.5, false));
Rituals.registerRitual("AW031DemonPortal", 2, 15000000, new RitualEffectDemonPortal(), "Convocation of the Damned", new AlchemyCircleRenderer(new ResourceLocation("alchemicalwizardry:textures/models/TransCircleDemon.png"), 220, 22, 22, 255, 0, 0.501, 0.501, 0, 5, false));
//Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock"));
}
@ -1246,7 +1266,7 @@ public class AlchemicalWizardry
public static void initDemonPacketRegistiry()
{
DemonPacketRegistry.registerDemonPacket("angel", new DemonPacketAngel());
DemonPacketRegistry.registerDemonPacket("angel", new DemonPacketMinorGrunt());
}
public static void initiateRegistry()

View file

@ -82,6 +82,7 @@ public class BloodMagicConfiguration
AlchemicalWizardry.customPotionSoulHardenID = config.get("Potion ID", "SoulHarden", 112).getInt();
AlchemicalWizardry.customPotionDeafID = config.get("Potion ID", "Deaf", 113).getInt();
AlchemicalWizardry.customPotionFeatherFallID = config.get("Potion ID", "FeatherFall", 114).getInt();
AlchemicalWizardry.customPotionDemonCloakID = config.get("Potion ID", "DemonCloak", 114).getInt();
MeteorParadigm.maxChance = config.get("meteor", "maxChance", 1000).getInt();
AlchemicalWizardry.doMeteorsDestroyBlocks = config.get("meteor", "doMeteorsDestroyBlocks", true).getBoolean(true);

View file

@ -289,9 +289,7 @@ public class Rituals
{
ritual.effect.onRitualBroken(ritualStone, method);
}
}
System.out.println(method);
}
}
public static int getNumberOfRituals()

View file

@ -8,6 +8,10 @@ import WayofTime.alchemicalWizardry.api.spell.EntitySpellProjectile;
import WayofTime.alchemicalWizardry.common.CommonProxy;
import WayofTime.alchemicalWizardry.common.EntityAirElemental;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBileDemon;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityBoulderFist;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityEarthElemental;
@ -51,9 +55,9 @@ import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBileDemon;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderBoulderFist;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderElemental;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderFallenAngel;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderGrunt;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderIceDemon;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderLowerGuardian;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderShade;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderSmallEarthGolem;
import WayofTime.alchemicalWizardry.common.renderer.mob.RenderWingedFireDemon;
@ -63,6 +67,7 @@ import WayofTime.alchemicalWizardry.common.renderer.model.ModelElemental;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelFallenAngel;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelIceDemon;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelLowerGuardian;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelShade;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelSmallEarthGolem;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelWingedFireDemon;
@ -114,7 +119,12 @@ public class ClientProxy extends CommonProxy
RenderingRegistry.registerEntityRenderingHandler(EntityFireElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityShadeElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityHolyElemental.class, new RenderElemental(new ModelElemental(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGrunt.class, new RenderGrunt(new ModelShade(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGrunt.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntFire.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntIce.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntWind.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F));
RenderingRegistry.registerEntityRenderingHandler(EntityMinorDemonGruntEarth.class, new RenderMinorDemonGrunt(new ModelMinorDemonGrunt(), 0.5F));
ClientRegistry.bindTileEntitySpecialRenderer(TEAltar.class, new TEAltarRenderer());
ClientRegistry.bindTileEntitySpecialRenderer(TEPedestal.class, new RenderPedestal());
ClientRegistry.bindTileEntitySpecialRenderer(TEPlinth.class, new RenderPlinth());

View file

@ -0,0 +1,29 @@
package WayofTime.alchemicalWizardry.common;
import net.minecraft.entity.EntityLivingBase;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityDemon;
public class EntityAITargetAggroCloaking extends EntityAITargetAggro
{
int cloakLevel; //Level of cloaking that the owner demon is fooled by
public EntityAITargetAggroCloaking(EntityDemon par1EntityDemon, Class par2Class, int par3, boolean par4, int cloak)
{
super(par1EntityDemon, par2Class, par3, par4);
this.cloakLevel = cloak;
}
@Override
public boolean shouldExecute()
{
EntityLivingBase target = this.taskOwner.getAITarget();
boolean cloakActive = false;
if(target != null && target.isPotionActive(AlchemicalWizardry.customPotionBoost.id))
{
cloakActive = target.getActivePotionEffect(AlchemicalWizardry.customPotionBoost).getAmplifier() >= cloakLevel;
}
return !cloakActive && super.shouldExecute();
}
}

View file

@ -7,4 +7,8 @@ public interface IDemon
public boolean isAggro();
public void setAggro(boolean aggro);
public boolean getDoesDropCrystal();
public void setDropCrystal(boolean crystal);
}

View file

@ -1,12 +1,13 @@
package WayofTime.alchemicalWizardry.common.block;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import net.minecraft.block.Block;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
public class BlockDemonPortal extends BlockContainer
{
@ -18,6 +19,17 @@ public class BlockDemonPortal extends BlockContainer
setCreativeTab(AlchemicalWizardry.tabBloodMagic);
this.setBlockName("demonPortal");
}
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEDemonPortal)
{
((TEDemonPortal) tile).notifyPortalOfBreak();
}
super.breakBlock(world, x, y, z, block, meta);
}
@Override
public TileEntity createNewTileEntity(World var1, int var2)

View file

@ -1,34 +0,0 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
public class DemonPacketAngel extends DemonHoardPacket
{
@Override
public boolean canFitType(DemonType type)
{
return true;
}
@Override
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
{
return 1.0f;
}
@Override
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
{
EntityLivingBase entity = new EntityMinorDemonGrunt(world);
entity.setPosition(x, y, z);
world.spawnEntityInWorld(entity);
teDemonPortal.enthrallDemon(entity);
return 1;
}
}

View file

@ -0,0 +1,61 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
public class DemonPacketMinorGrunt extends DemonHoardPacket
{
@Override
public boolean canFitType(DemonType type)
{
return true;
}
@Override
public float getRelativeChance(DemonType type, int tier, boolean spawnGuardian)
{
return 1.0f;
}
@Override
public int summonDemons(TEDemonPortal teDemonPortal, World world, int x, int y, int z, DemonType type, int tier, boolean spawnGuardian)
{
EntityMinorDemonGrunt entity;
switch(type)
{
case FIRE:
entity = new EntityMinorDemonGruntFire(world);
break;
case ICE:
entity = new EntityMinorDemonGruntIce(world);
break;
case WATER:
entity = new EntityMinorDemonGruntEarth(world);
break;
case WIND:
entity = new EntityMinorDemonGruntWind(world);
break;
case NORMAL:
default:
entity = new EntityMinorDemonGrunt(world);
break;
}
entity.setPosition(x, y, z);
world.spawnEntityInWorld(entity);
teDemonPortal.enthrallDemon(entity);
entity.setAggro(true);
entity.setDropCrystal(false);
return 1;
}
}

View file

@ -2,6 +2,7 @@ package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard;
public enum DemonType
{
NORMAL,
FIRE,
WATER,
ICE,

View file

@ -25,7 +25,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.ModItems;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggro;
import WayofTime.alchemicalWizardry.common.EntityAITargetAggroCloaking;
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityAIOccasionalRangedAttack;
import WayofTime.alchemicalWizardry.common.demonVillage.ai.EntityDemonAIHurtByTarget;
@ -62,8 +62,8 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
this.targetTasks.addTask(1, new EntityAIOwnerHurtByTarget(this));
this.targetTasks.addTask(2, new EntityAIOwnerHurtTarget(this));
this.targetTasks.addTask(3, new EntityDemonAIHurtByTarget(this, true));
this.targetTasks.addTask(4, new EntityAITargetAggro(this, EntityPlayer.class, 0, false));
this.setAggro(true);
this.targetTasks.addTask(4, new EntityAITargetAggroCloaking(this, EntityPlayer.class, 0, false, 0));
this.setAggro(false);
this.setTamed(false);
demonPortal = new Int3(0,0,0);
@ -419,6 +419,12 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@ -428,6 +434,10 @@ public class EntityMinorDemonGrunt extends EntityDemon implements IOccasionalRan
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;

View file

@ -0,0 +1,50 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.ExplosionProjectile;
public class EntityMinorDemonGruntEarth extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntEarth(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntEarthID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
if(par1Entity instanceof EntityLivingBase)
{
((EntityLivingBase) par1Entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 200, 2));
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
ExplosionProjectile hol = new ExplosionProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600, false);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,45 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.FireProjectile;
public class EntityMinorDemonGruntFire extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntFire(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntFireID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
par1Entity.setFire(10);
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
FireProjectile hol = new FireProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.IceProjectile;
public class EntityMinorDemonGruntIce extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntIce(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntIceID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
IceProjectile hol = new IceProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -0,0 +1,43 @@
package WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.entity.projectile.WindGustProjectile;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class EntityMinorDemonGruntWind extends EntityMinorDemonGrunt
{
public EntityMinorDemonGruntWind(World par1World)
{
super(par1World);
this.setDemonID(AlchemicalWizardry.entityMinorDemonGruntWindID);
}
@Override
public boolean attackEntityAsMob(Entity par1Entity)
{
int i = this.isTamed() ? 20 : 20;
if(par1Entity instanceof IHoardDemon && ((IHoardDemon) par1Entity).isSamePortal(this))
{
return false;
}
return par1Entity.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
@Override
public void attackEntityWithRangedAttack(EntityLivingBase par1EntityLivingBase, float par2)
{
if(par1EntityLivingBase instanceof IHoardDemon && ((IHoardDemon) par1EntityLivingBase).isSamePortal(this))
{
return;
}
double xCoord;
double yCoord;
double zCoord;
WindGustProjectile hol = new WindGustProjectile(worldObj, this, par1EntityLivingBase, 1.8f, 0f, 15, 600);
this.worldObj.spawnEntityInWorld(hol);
}
}

View file

@ -32,12 +32,12 @@ public class BlockDemonChest extends BlockChest implements IBlockPortalNode
@Override
public void breakBlock(World world, int x, int y, int z, Block block, int meta)
{
super.breakBlock(world, x, y, z, block, meta);
TileEntity tile = world.getTileEntity(x, y, z);
if(tile instanceof TEDemonChest)
{
((TEDemonChest) tile).notifyPortalOfInteraction();
}
super.breakBlock(world, x, y, z, block, meta);
}
// @Override

View file

@ -15,6 +15,7 @@ import java.util.Random;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityCreature;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -43,16 +44,18 @@ import com.google.gson.GsonBuilder;
public class TEDemonPortal extends TileEntity
{
public static boolean printDebug = false;
public DemonType type = DemonType.FIRE;
public static boolean printDebug = true;
public static int buildingGridDelay = 25;
public static int roadGridDelay = 10;
public static int demonHoardDelay = 40;
public static float demonRoadChance = 0.6f;
public static float demonRoadChance = 0.3f;
public static float demonHouseChance = 0.6f;
public static float demonPortalChance = 0.5f;
public static float demonHoardChance = 1.0f;
public static float portalTickRate = 0.1f;
public static float portalTickRate = 1f;
public static int[] tierCostList = new int[]{1000, 5000, 10000};
@ -82,6 +85,8 @@ public class TEDemonPortal extends TileEntity
public int buildingStage = -1;
public int delayBeforeParty = 0;
public int lockdownTimer;
public TEDemonPortal()
@ -287,7 +292,10 @@ public class TEDemonPortal extends TileEntity
{
return;
}
DemonType[] types = DemonType.values();
this.type = types[rand.nextInt(types.length)];
for (int xIndex = -negXRadius; xIndex <= posXRadius; xIndex++)
{
for (int zIndex = -negZRadius; zIndex <= posZRadius; zIndex++)
@ -313,18 +321,52 @@ public class TEDemonPortal extends TileEntity
if (this.createRandomBuilding(DemonBuilding.BUILDING_PORTAL, tier) >= 1)
{
System.out.println("Portal building successfully found!");
this.buildingStage = 0;
}
isInitialized = true;
}
public void createParty()
{
worldObj.createExplosion(null, xCoord + rand.nextInt(10) - rand.nextInt(10), yCoord, zCoord + rand.nextInt(10) - rand.nextInt(10), 5*rand.nextFloat(), false);
}
public void start()
{
this.delayBeforeParty = 200;
}
/**
* Randomly increase one of the cooldowns such that a road, house, or a demon portal tier is caused. Demons are also randomly spawned via this mechanic.
*/
@Override
public void updateEntity()
{
if(worldObj.isRemote)
{
return;
}
if(this.delayBeforeParty > 0)
{
this.delayBeforeParty--;
if(rand.nextInt(20) == 0)
{
this.createParty();
}
if(delayBeforeParty <= 0)
{
worldObj.createExplosion(null, xCoord, yCoord, zCoord, 15, false);
this.initialize();
}
return;
}
if (!isInitialized)
{
return;
@ -370,7 +412,7 @@ public class TEDemonPortal extends TileEntity
if(this.demonHoardCooldown <= 0)
{
int complexityCost = this.createRandomDemonHoard(this, tier, DemonType.FIRE, this.isLockedDown());
int complexityCost = this.createRandomDemonHoard(this, tier, this.type, this.isLockedDown());
if(complexityCost > 0)
{
this.demonHoardCooldown = TEDemonPortal.demonHoardDelay * complexityCost;
@ -448,6 +490,8 @@ public class TEDemonPortal extends TileEntity
this.pointPool = par1NBTTagCompound.getFloat("pointPool");
this.lockdownTimer = par1NBTTagCompound.getInteger("lockdownTimer");
this.delayBeforeParty = par1NBTTagCompound.getInteger("delayBeforeParty");
this.type = DemonType.valueOf(par1NBTTagCompound.getString("demonType"));
}
@Override
@ -497,6 +541,8 @@ public class TEDemonPortal extends TileEntity
par1NBTTagCompound.setInteger("nextDemonPortalDirection", this.nextDemonPortalDirection.ordinal());
par1NBTTagCompound.setFloat("pointPool", pointPool);
par1NBTTagCompound.setInteger("lockdownTimer", this.lockdownTimer);
par1NBTTagCompound.setInteger("delayBeforeParty", delayBeforeParty);
par1NBTTagCompound.setString("demonType", this.type.toString());
}
public int createRandomDemonHoard(TEDemonPortal teDemonPortal, int tier, DemonType type, boolean spawnGuardian)
@ -1170,10 +1216,11 @@ public class TEDemonPortal extends TileEntity
{
for (DemonBuilding build : TEDemonPortal.buildingList)
{
if (build.buildingType != DemonBuilding.BUILDING_PORTAL)
if (build.buildingType != DemonBuilding.BUILDING_PORTAL || build.buildingTier != buildingTier)
{
continue;
}
System.out.println("This one matches!");
if (schemMap.containsKey(nextDir))
{
schemMap.get(nextDir).add(build);
@ -1436,6 +1483,8 @@ public class TEDemonPortal extends TileEntity
{
case 0:
return rand.nextFloat() < 0.6 ? Blocks.cobblestone : Blocks.mossy_cobblestone;
case 1:
return Blocks.stonebrick;
default:
return Blocks.nether_brick;
}
@ -1443,6 +1492,11 @@ public class TEDemonPortal extends TileEntity
public int getRoadMeta()
{
switch(this.tier)
{
case 1:
return rand.nextFloat() < 0.6 ? 1 : 0;
}
return 0;
}
@ -1504,4 +1558,15 @@ public class TEDemonPortal extends TileEntity
{
this.demonHouseCooldown += addition;
}
public void notifyPortalOfBreak()
{
for(IHoardDemon demon : hoardList)
{
if(demon instanceof Entity)
{
((Entity) demon).setDead();
}
}
}
}

View file

@ -15,12 +15,26 @@ public class EntityDemon extends EntityTameable implements IDemon
{
private boolean isAggro;
private String demonID;
protected boolean dropCrystal = true;
public EntityDemon(World par1World, String demonID)
{
super(par1World);
this.demonID = demonID;
}
@Override
public boolean getDoesDropCrystal()
{
return dropCrystal;
}
@Override
public void setDropCrystal(boolean crystal)
{
this.dropCrystal = crystal;
}
@Override
public void setSummonedConditions()
@ -49,21 +63,24 @@ public class EntityDemon extends EntityTameable implements IDemon
protected void dropFewItems(boolean par1, int par2)
{
ItemStack drop = new ItemStack(ModItems.demonPlacer);
DemonPlacer.setDemonString(drop, this.getDemonID());
if(this.getDoesDropCrystal())
{
ItemStack drop = new ItemStack(ModItems.demonPlacer);
DemonPlacer.setDemonString(drop, this.getDemonID());
if ((this.getOwner() instanceof EntityPlayer))
{
DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer) this.getOwner()));
}
if ((this.getOwner() instanceof EntityPlayer))
{
DemonPlacer.setOwnerName(drop, SpellHelper.getUsername((EntityPlayer) this.getOwner()));
}
if (this.hasCustomNameTag())
{
drop.setStackDisplayName(this.getCustomNameTag());
}
if (this.hasCustomNameTag())
{
drop.setStackDisplayName(this.getCustomNameTag());
}
this.entityDropItem(drop, 0.0f);
this.entityDropItem(drop, 0.0f);
}
}
public void onLivingUpdate()
@ -98,4 +115,9 @@ public class EntityDemon extends EntityTameable implements IDemon
{
return this.demonID;
}
protected void setDemonID(String id)
{
this.demonID = id;
}
}

View file

@ -32,6 +32,12 @@ public class ExplosionProjectile extends EnergyBlastProjectile
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
causesEnvDamage = flag;
}
public ExplosionProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir, boolean flag)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
causesEnvDamage = flag;
}
@Override
public DamageSource getDamageSource()
@ -48,6 +54,8 @@ public class ExplosionProjectile extends EnergyBlastProjectile
{
return;
}
this.onImpact(mop.entityHit);
worldObj.createExplosion(this, this.posX, this.posY, this.posZ, (float) (2), causesEnvDamage);
} else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK)
@ -69,20 +77,10 @@ public class ExplosionProjectile extends EnergyBlastProjectile
{
if (mop instanceof EntityLivingBase)
{
if (((EntityLivingBase) mop).isImmuneToFire())
{
doDamage((int) (projectileDamage), mop);
} else
{
doDamage(projectileDamage, mop);
}
doDamage(projectileDamage, mop);
}
}
if (worldObj.isAirBlock((int) this.posX, (int) this.posY, (int) this.posZ))
{
}
spawnHitParticles("magicCrit", 8);
this.setDead();
}

View file

@ -83,7 +83,7 @@ public class FireProjectile extends EnergyBlastProjectile
{
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).setFire(50);
((EntityLivingBase) mop).setFire(10 * this.projectileDamage);
((EntityLivingBase) mop).setRevengeTarget(shootingEntity);
if (((EntityLivingBase) mop).isPotionActive(Potion.fireResistance) || ((EntityLivingBase) mop).isImmuneToFire())

View file

@ -1,7 +1,5 @@
package WayofTime.alchemicalWizardry.common.entity.projectile;
import WayofTime.alchemicalWizardry.common.entity.mob.EntityIceDemon;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.potion.Potion;
@ -9,6 +7,7 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
public class IceProjectile extends EnergyBlastProjectile
{
@ -31,10 +30,10 @@ public class IceProjectile extends EnergyBlastProjectile
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public IceProjectile(World worldObj, EntityIceDemon entityIceDemon, EntityLivingBase par1EntityLivingBase, float f, float g, int i, int j)
public IceProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(worldObj, entityIceDemon, par1EntityLivingBase, f, g, i, j);
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override

View file

@ -28,6 +28,11 @@ public class WindGustProjectile extends EnergyBlastProjectile
{
super(par1World, par2EntityPlayer, damage, maxTicksInAir, posX, posY, posZ, rotationYaw, rotationPitch);
}
public WindGustProjectile(World par1World, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase, float par4, float par5, int damage, int maxTicksInAir)
{
super(par1World, par2EntityLivingBase, par3EntityLivingBase, par4, par5, damage, maxTicksInAir);
}
@Override
public DamageSource getDamageSource()
@ -63,9 +68,9 @@ public class WindGustProjectile extends EnergyBlastProjectile
{
if (mop instanceof EntityLivingBase)
{
((EntityLivingBase) mop).motionX = this.motionX * 2;
((EntityLivingBase) mop).motionX = this.motionX * 0.25*this.projectileDamage;
((EntityLivingBase) mop).motionY = 1.5;
((EntityLivingBase) mop).motionZ = this.motionZ * 2;
((EntityLivingBase) mop).motionZ = this.motionZ * 0.25*this.projectileDamage;
}
}

View file

@ -22,6 +22,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.common.IDemon;
import WayofTime.alchemicalWizardry.common.spell.complex.effect.SpellHelper;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
@ -72,6 +73,13 @@ public class DaggerOfSacrifice extends EnergyItems
return false;
}
if(par2EntityLivingBase instanceof IDemon)
{
System.out.println("Demon");
((IDemon)par2EntityLivingBase).setDropCrystal(false);
this.findAndNotifyAltarOfDemon(world, par2EntityLivingBase);
}
if (par2EntityLivingBase instanceof EntityVillager && !par2EntityLivingBase.isChild())
{
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 2000))
@ -151,6 +159,8 @@ public class DaggerOfSacrifice extends EnergyItems
if (findAndFillAltar(par2EntityLivingBase.worldObj, par2EntityLivingBase, 500))
{
double posX = par2EntityLivingBase.posX;
double posY = par2EntityLivingBase.posY;
double posZ = par2EntityLivingBase.posZ;
@ -200,7 +210,6 @@ public class DaggerOfSacrifice extends EnergyItems
}
@Override
public Multimap getItemAttributeModifiers()
{
Multimap multimap = super.getItemAttributeModifiers();
@ -208,6 +217,23 @@ public class DaggerOfSacrifice extends EnergyItems
return multimap;
}
public boolean findAndNotifyAltarOfDemon(World world, EntityLivingBase sacrifice)
{
int posX = (int) Math.round(sacrifice.posX - 0.5f);
int posY = (int) sacrifice.posY;
int posZ = (int) Math.round(sacrifice.posZ - 0.5f);
TEAltar altarEntity = this.getAltar(world, posX, posY, posZ);
if (altarEntity == null)
{
return false;
}
altarEntity.addToDemonBloodDuration(50);
return true;
}
public boolean findAndFillAltar(World world, EntityLivingBase sacrifice, int amount)
{
int posX = (int) Math.round(sacrifice.posX - 0.5f);

View file

@ -24,7 +24,7 @@ import java.util.List;
public class ItemAttunedCrystal extends Item implements IReagentManipulator
{
public static final int maxDistance = 5;
public static final int maxDistance = 6;
public IIcon crystalBody;
public IIcon crystalLabel;

View file

@ -0,0 +1,18 @@
package WayofTime.alchemicalWizardry.common.potion;
import net.minecraft.potion.Potion;
public class PotionDemonCloak extends Potion
{
public PotionDemonCloak(int par1, boolean par2, int par3)
{
super(par1, par2, par3);
}
@Override
public Potion setIconIndex(int par1, int par2)
{
super.setIconIndex(par1, par2);
return this;
}
}

View file

@ -0,0 +1,49 @@
package WayofTime.alchemicalWizardry.common.renderer.mob;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.renderer.entity.RenderLiving;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGrunt;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntEarth;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntFire;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntIce;
import WayofTime.alchemicalWizardry.common.demonVillage.demonHoard.demon.EntityMinorDemonGruntWind;
public class RenderMinorDemonGrunt extends RenderLiving
{
private static final ResourceLocation normalTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_normal.png");
private static final ResourceLocation fireTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_fire.png");
private static final ResourceLocation iceTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_ice.png");
private static final ResourceLocation windTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_wind.png");
private static final ResourceLocation earthTexture = new ResourceLocation("alchemicalwizardry", "textures/models/MinorDemonGrunt_earth.png");
public RenderMinorDemonGrunt(ModelBase par1ModelBase, float par2)
{
super(par1ModelBase, par2);
}
public ResourceLocation func_110832_a(EntityMinorDemonGrunt entity)
{
if(entity instanceof EntityMinorDemonGruntFire)
{
return fireTexture;
}else if(entity instanceof EntityMinorDemonGruntWind)
{
return windTexture;
}else if(entity instanceof EntityMinorDemonGruntIce)
{
return iceTexture;
}else if(entity instanceof EntityMinorDemonGruntEarth)
{
return earthTexture;
}
return normalTexture;
}
public ResourceLocation getEntityTexture(Entity entity)
{
return this.func_110832_a((EntityMinorDemonGrunt) entity);
}
}

View file

@ -0,0 +1,113 @@
package WayofTime.alchemicalWizardry.common.renderer.model;
import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
public class ModelMinorDemonGrunt extends ModelBase
{
//fields
ModelRenderer head;
ModelRenderer chest;
ModelRenderer midrift;
ModelRenderer rightarm;
ModelRenderer leftarm;
ModelRenderer rightleg;
ModelRenderer leftleg;
ModelRenderer middle;
public ModelMinorDemonGrunt()
{
textureWidth = 128;
textureHeight = 64;
head = new ModelRenderer(this, 0, 0);
head.addBox(-4F, -8F, -4F, 8, 8, 8);
head.setRotationPoint(0F, 0F, 0F);
head.setTextureSize(128, 64);
head.mirror = true;
setRotation(head, 0F, 0F, 0F);
chest = new ModelRenderer(this, 16, 16);
chest.addBox(-5F, 0F, -3.5F, 10, 7, 7);
chest.setRotationPoint(0F, 0F, 0F);
chest.setTextureSize(128, 64);
chest.mirror = true;
setRotation(chest, 0F, 0F, 0F);
midrift = new ModelRenderer(this, 16, 33);
midrift.addBox(-4F, 7F, -2F, 8, 5, 4);
midrift.setRotationPoint(0F, 0F, 0F);
midrift.setTextureSize(128, 64);
midrift.mirror = true;
setRotation(midrift, 0F, 0F, 0F);
rightarm = new ModelRenderer(this, 50, 16);
rightarm.mirror = true;
rightarm.addBox(-3F, -2F, -2F, 4, 12, 4);
rightarm.setRotationPoint(-6F, 2F, 0F);
rightarm.setTextureSize(128, 64);
rightarm.mirror = true;
setRotation(rightarm, 0F, 0F, 0F);
rightarm.mirror = false;
leftarm = new ModelRenderer(this, 50, 16);
leftarm.addBox(-1F, -2F, -2F, 4, 12, 4);
leftarm.setRotationPoint(6F, 2F, 0F);
leftarm.setTextureSize(128, 64);
leftarm.mirror = true;
setRotation(leftarm, 0F, 0F, 0F);
rightleg = new ModelRenderer(this, 0, 16);
rightleg.mirror = true;
rightleg.addBox(-2F, 0F, -2F, 4, 12, 4);
rightleg.setRotationPoint(-2F, 12F, 0F);
rightleg.setTextureSize(128, 64);
rightleg.mirror = true;
setRotation(rightleg, 0F, 0F, 0F);
rightleg.mirror = false;
leftleg = new ModelRenderer(this, 0, 16);
leftleg.addBox(-2F, 0F, -2F, 4, 12, 4);
leftleg.setRotationPoint(2F, 12F, 0F);
leftleg.setTextureSize(128, 64);
leftleg.mirror = true;
setRotation(leftleg, 0F, 0F, 0F);
middle = new ModelRenderer(this, 16, 43);
middle.addBox(-2F, 7F, -3F, 4, 3, 1);
middle.setRotationPoint(0F, 0F, 0F);
middle.setTextureSize(128, 64);
middle.mirror = true;
setRotation(middle, 0F, 0F, 0F);
}
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
{
super.render(entity, f, f1, f2, f3, f4, f5);
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
head.render(f5);
chest.render(f5);
midrift.render(f5);
rightarm.render(f5);
leftarm.render(f5);
rightleg.render(f5);
leftleg.render(f5);
middle.render(f5);
}
private void setRotation(ModelRenderer model, float x, float y, float z)
{
model.rotateAngleX = x;
model.rotateAngleY = y;
model.rotateAngleZ = z;
}
public void setRotationAngles(float f, float f1, float f2, float f3, float f4, float f5, Entity entity)
{
super.setRotationAngles(f, f1, f2, f3, f4, f5, entity);
this.head.rotateAngleX = f4 / (180F / (float) Math.PI);
this.head.rotateAngleY = f3 / (180F / (float) Math.PI);
this.leftleg.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
this.rightleg.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1;
this.rightarm.rotateAngleX = MathHelper.cos(f * 0.6662F + (float) Math.PI) * 1.0F * f1;
this.leftarm.rotateAngleX = MathHelper.cos(f * 0.6662F) * 1.4F * f1;
}
}

View file

@ -0,0 +1,212 @@
package WayofTime.alchemicalWizardry.common.rituals;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import net.minecraft.entity.effect.EntityLightningBolt;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.ModBlocks;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry;
import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone;
import WayofTime.alchemicalWizardry.api.rituals.RitualComponent;
import WayofTime.alchemicalWizardry.api.rituals.RitualEffect;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.Int3;
import WayofTime.alchemicalWizardry.common.demonVillage.tileEntity.TEDemonPortal;
import WayofTime.alchemicalWizardry.common.tileEntity.TEAltar;
import WayofTime.alchemicalWizardry.common.tileEntity.TEBellJar;
public class RitualEffectDemonPortal extends RitualEffect
{
public static final int neededAmount = 16000;
public static final Random rand = new Random();
public static final int drainRate = 50;
public static final Reagent[] reagents = new Reagent[]{ReagentRegistry.aetherReagent, ReagentRegistry.aquasalusReagent, ReagentRegistry.terraeReagent, ReagentRegistry.incendiumReagent, ReagentRegistry.sanctusReagent, ReagentRegistry.tenebraeReagent, ReagentRegistry.magicalesReagent, ReagentRegistry.potentiaReagent};
public static final Int3[] jarLocations = new Int3[]{new Int3(4, 5, 4), new Int3(-4, 5, 4), new Int3(4, 5, -4), new Int3(-4, 5, -4), new Int3(0, 5, 6), new Int3(0, 5, -6), new Int3(6, 5, 0), new Int3(-6, 5, 0)};
@Override
public void performEffect(IMasterRitualStone ritualStone)
{
String owner = ritualStone.getOwner();
int currentEssence = SoulNetworkHandler.getCurrentEssence(owner);
World world = ritualStone.getWorld();
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
if (currentEssence < this.getCostPerRefresh())
{
SoulNetworkHandler.causeNauseaToPlayer(owner);
} else
{
NBTTagCompound tag = ritualStone.getCustomRitualTag();
boolean reagentsFulfilled = true;
for(Reagent reagent : reagents)
{
int reagentAmount = tag.getInteger(ReagentRegistry.getKeyForReagent(reagent));
if(reagentAmount < neededAmount)
{
reagentsFulfilled = false;
System.out.println("Reagents not fulfilled. Missing: " + ReagentRegistry.getKeyForReagent(reagent));
int drainAmount = Math.min(drainRate, neededAmount - reagentAmount);
if(drainAmount <= 0)
{
continue;
}
if(this.canDrainReagent(ritualStone, reagent, drainAmount, true))
{
if(rand.nextInt(10) == 0)
{
this.createRandomLightning(world, x, y, z);
}
reagentAmount += drainAmount;
tag.setInteger(ReagentRegistry.getKeyForReagent(reagent), reagentAmount);
break;
}
}
}
ritualStone.setCustomRitualTag(tag);
if(reagentsFulfilled && checkCreatePortal(ritualStone))
{
world.setBlock(x, y+1, z, ModBlocks.blockDemonPortal);
TEDemonPortal portal = (TEDemonPortal) world.getTileEntity(x, y + 1, z);
portal.start();
ritualStone.setActive(false);
}
SoulNetworkHandler.syphonFromNetwork(owner, this.getCostPerRefresh());
}
}
public boolean checkCreatePortal(IMasterRitualStone ritualStone)
{
TileEntity entity = ritualStone.getWorld().getTileEntity(ritualStone.getXCoord(), ritualStone.getYCoord() + 1, ritualStone.getZCoord());
if(entity instanceof TEAltar)
{
TEAltar altar = (TEAltar)entity;
if(altar.hasDemonBlood() && ritualStone.getWorld().isAirBlock(ritualStone.getXCoord(), ritualStone.getYCoord() + 2, ritualStone.getZCoord()))
{
return true;
}
}
return false;
}
@Override
public int getCostPerRefresh()
{
return 0;
}
public void createRandomLightning(World world, int x, int y, int z)
{
world.addWeatherEffect(new EntityLightningBolt(world, x + rand.nextInt(10) - rand.nextInt(10), y + 1, z + rand.nextInt(10) - rand.nextInt(10)));
}
@Override
public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player)
{
if(!checkJars(ritualStone))
{
player.addChatMessage(new ChatComponentText("A jar on one of the pillars appears to be missing..."));
return false;
}
return true;
}
public boolean checkJars(IMasterRitualStone ritualStone)
{
int x = ritualStone.getXCoord();
int y = ritualStone.getYCoord();
int z = ritualStone.getZCoord();
for(Int3 pos : jarLocations)
{
if(!(ritualStone.getWorld().getTileEntity(x + pos.xCoord, y + pos.yCoord, z + pos.zCoord) instanceof TEBellJar))
{
return false;
}
}
return true;
}
@Override
public List<RitualComponent> getRitualComponentList()
{
ArrayList<RitualComponent> demonRitual = new ArrayList();
this.addParallelRunes(demonRitual, 3, 0, RitualComponent.FIRE);
this.addParallelRunes(demonRitual, 5, 0, RitualComponent.FIRE);
this.addCornerRunes(demonRitual, 2, 0, RitualComponent.AIR);
this.addCornerRunes(demonRitual, 3, 0, RitualComponent.DUSK);
this.addOffsetRunes(demonRitual, 3, 4, 0, RitualComponent.AIR);
this.addCornerRunes(demonRitual, 4, 1, RitualComponent.BLANK);
this.addCornerRunes(demonRitual, 4, 2, RitualComponent.EARTH);
this.addCornerRunes(demonRitual, 4, 3, RitualComponent.EARTH);
this.addCornerRunes(demonRitual, 4, 4, RitualComponent.DUSK);
this.addParallelRunes(demonRitual, 6, 1, RitualComponent.BLANK);
this.addParallelRunes(demonRitual, 6, 2, RitualComponent.WATER);
this.addParallelRunes(demonRitual, 6, 3, RitualComponent.WATER);
this.addParallelRunes(demonRitual, 6, 4, RitualComponent.DUSK);
this.addOffsetRunes(demonRitual, 2, 6, 1, RitualComponent.FIRE);
this.addOffsetRunes(demonRitual, 2, 7, 1, RitualComponent.BLANK);
this.addOffsetRunes(demonRitual, 2, 8, 1, RitualComponent.FIRE);
this.addOffsetRunes(demonRitual, 2, 9, 1, RitualComponent.BLANK);
this.addOffsetRunes(demonRitual, 1, 9, 1, RitualComponent.AIR);
this.addParallelRunes(demonRitual, 9, 2, RitualComponent.DUSK);
this.addCornerRunes(demonRitual, 6, 3, RitualComponent.BLANK);
this.addOffsetRunes(demonRitual, 6, 7, 3, RitualComponent.BLANK);
this.addOffsetRunes(demonRitual, 5, 7, 3, RitualComponent.AIR);
this.addOffsetRunes(demonRitual, 4, 7, 3, RitualComponent.AIR);
return demonRitual;
}
public void addOffsetRunes(ArrayList<RitualComponent> ritualList, int off1, int off2, int y, int rune)
{
ritualList.add(new RitualComponent(off1, y, off2, rune));
ritualList.add(new RitualComponent(off2, y, off1, rune));
ritualList.add(new RitualComponent(off1, y, -off2, rune));
ritualList.add(new RitualComponent(-off2, y, off1, rune));
ritualList.add(new RitualComponent(-off1, y, off2, rune));
ritualList.add(new RitualComponent(off2, y, -off1, rune));
ritualList.add(new RitualComponent(-off1, y, -off2, rune));
ritualList.add(new RitualComponent(-off2, y, -off1, rune));
}
public void addCornerRunes(ArrayList<RitualComponent> ritualList, int off1, int y, int rune)
{
ritualList.add(new RitualComponent(off1, y, off1, rune));
ritualList.add(new RitualComponent(off1, y, -off1, rune));
ritualList.add(new RitualComponent(-off1, y, -off1, rune));
ritualList.add(new RitualComponent(-off1, y, off1, rune));
}
public void addParallelRunes(ArrayList<RitualComponent> ritualList, int off1, int y, int rune)
{
ritualList.add(new RitualComponent(off1, y, 0, rune));
ritualList.add(new RitualComponent(-off1, y, 0, rune));
ritualList.add(new RitualComponent(0, y, -off1, rune));
ritualList.add(new RitualComponent(0, y, off1, rune));
}
}

View file

@ -66,6 +66,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
private int hasChanged = 0;
private int lockdownDuration;
private int demonBloodDuration;
public TEAltar()
{
@ -88,6 +89,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
isResultBlock = false;
progress = 0;
this.lockdownDuration = 0;
this.demonBloodDuration = 0;
}
/**
@ -106,6 +108,21 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
{
return 5;
}
public void addToDemonBloodDuration(int dur)
{
this.demonBloodDuration++;
}
public boolean hasDemonBlood()
{
return this.demonBloodDuration > 0;
}
public void decrementDemonBlood()
{
this.demonBloodDuration = Math.max(0, this.demonBloodDuration - 1);
}
@Override
public void readFromNBT(NBTTagCompound par1NBTTagCompound)
@ -171,6 +188,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
isResultBlock = par1NBTTagCompound.getBoolean("isResultBlock");
lockdownDuration = par1NBTTagCompound.getInteger("lockdownDuration");
accelerationUpgrades = par1NBTTagCompound.getInteger("accelerationUpgrades");
demonBloodDuration = par1NBTTagCompound.getInteger("demonBloodDuration");
}
public void setMainFluid(FluidStack fluid)
@ -249,6 +267,7 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
par1NBTTagCompound.setInteger("bufferCapacity", bufferCapacity);
par1NBTTagCompound.setInteger("lockdownDuration", lockdownDuration);
par1NBTTagCompound.setInteger("accelerationUpgrades", this.accelerationUpgrades);
par1NBTTagCompound.setInteger("demonBloodDuration", demonBloodDuration);
}
@Override
@ -548,6 +567,13 @@ public class TEAltar extends TileEntity implements IInventory, IFluidTank, IFlui
@Override
public void updateEntity()
{
this.decrementDemonBlood();
if(this.hasDemonBlood() && !worldObj.isRemote)
{
SpellHelper.sendIndexedParticleToAllAround(worldObj, xCoord, yCoord, zCoord, 20, worldObj.provider.dimensionId, 1, xCoord, yCoord, zCoord);
}
if (this.lockdownDuration > 0)
{
this.lockdownDuration--;