More base-work on Omega

This commit is contained in:
WayofTime 2015-03-19 15:26:03 -04:00
parent d7d8aedd42
commit 18d07baad3
10 changed files with 336 additions and 30 deletions

View file

@ -158,6 +158,8 @@ import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLava;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLeap; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLeap;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLifeConduit; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectLifeConduit;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectMagnetic; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectMagnetic;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectOmegaStalling;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectOmegaTest;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSoulBound; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSoulBound;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSpawnWard; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSpawnWard;
import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSummonMeteor; import WayofTime.alchemicalWizardry.common.rituals.RitualEffectSummonMeteor;
@ -1368,8 +1370,8 @@ public class AlchemicalWizardry
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("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("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("AW031Convocation",isDemonRitualCreativeOnly ? 10 : 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("AW031Convocation",isDemonRitualCreativeOnly ? 10 : 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("AW032", 1, 100, new RitualEffectOmegaTest(), "Symmetry of the Omega"); Rituals.registerRitual("AW032", 1, 100, new RitualEffectOmegaTest(), "Symmetry of the Omega");
// Rituals.registerRitual("AW033", 2, 100, new RitualEffectOmegaStalling(), "Omega Stalling"); Rituals.registerRitual("AW033", 2, 100, new RitualEffectOmegaStalling(), "Omega Stalling");
// Rituals.registerRitual("AW034", 2, 100, new RitualEffectAlphaPact(), "Alpha Pact"); // Rituals.registerRitual("AW034", 2, 100, new RitualEffectAlphaPact(), "Alpha Pact");
Rituals.registerRitual("AW035", 1, 10000, new RitualEffectItemRouting(), "Orchestra of the Phantom Hands"); Rituals.registerRitual("AW035", 1, 10000, new RitualEffectItemRouting(), "Orchestra of the Phantom Hands");
//Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock")); //Rituals.registerRitual(1,100,new RitualEffectApiaryOverclock(),"Apiary Overclock"));

View file

@ -6,7 +6,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
@ -33,14 +32,17 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent; import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn;
import net.minecraftforge.event.entity.player.EntityInteractEvent;
import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.OreDictionary;
import vazkii.botania.api.internal.IManaBurst; import vazkii.botania.api.internal.IManaBurst;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import WayofTime.alchemicalWizardry.BloodMagicConfiguration; import WayofTime.alchemicalWizardry.BloodMagicConfiguration;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.event.TeleposeEvent;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; import WayofTime.alchemicalWizardry.api.spell.APISpellHelper;
import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile; import WayofTime.alchemicalWizardry.common.entity.projectile.EnergyBlastProjectile;
import WayofTime.alchemicalWizardry.common.items.EnergySword;
import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour; import WayofTime.alchemicalWizardry.common.items.armour.BoundArmour;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour; import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
@ -66,7 +68,28 @@ public class AlchemicalWizardryEventHooks
public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap(); public static Map<Integer, List<CoordAndRange>> respawnMap = new HashMap();
public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap(); public static Map<Integer, List<CoordAndRange>> forceSpawnMap = new HashMap();
@SubscribeEvent
public void onEntityInteractEvent(EntityInteractEvent event)
{
EntityPlayer player = event.entityPlayer;
OmegaParadigm parad = OmegaRegistry.getOmegaParadigmOfWeilder(player);
if(parad == null)
{
return;
}
ItemStack heldItem = player.getHeldItem();
if(heldItem == null)
{
parad.onEmptyHandEntityInteract(player, event.target);
}else
{
if(heldItem.getItem() instanceof EnergySword)
{
parad.onBoundSwordInteractWithEntity(player, event.target);
}
}
}
@SubscribeEvent @SubscribeEvent
public void onAnvilUpdateEvent(AnvilUpdateEvent event) public void onAnvilUpdateEvent(AnvilUpdateEvent event)
{ {

View file

@ -7,7 +7,6 @@ import java.io.FileNotFoundException;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -211,25 +210,25 @@ public class BookParser
iEntryList.clear(); iEntryList.clear();
// //
File bmDirectory = new File("src/main/resources/assets/alchemicalwizardryBooks"); // File bmDirectory = new File("src/main/resources/assets/alchemicalwizardryBooks");
if(!bmDirectory.exists()) // if(!bmDirectory.exists())
{ // {
bmDirectory.mkdirs(); // bmDirectory.mkdirs();
} // }
//
File file = new File(bmDirectory, "books.txt"); // File file = new File(bmDirectory, "books.txt");
// if (file.exists() && file.length() > 3L) //// if (file.exists() && file.length() > 3L)
//// {
////
//// }else
// { // {
// // PrintWriter writer = new PrintWriter(file);
// }else // for(String stri : strings)
{ // {
PrintWriter writer = new PrintWriter(file); // writer.println(stri);
for(String stri : strings) // }
{ // writer.close();
writer.println(stri); // }
}
writer.close();
}
// //
} }

View file

@ -1,8 +1,7 @@
package WayofTime.alchemicalWizardry.common.items; package WayofTime.alchemicalWizardry.common.items;
import WayofTime.alchemicalWizardry.AlchemicalWizardry; import java.util.List;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.client.renderer.texture.IIconRegister;
@ -18,8 +17,11 @@ import net.minecraft.potion.PotionEffect;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.world.World; import net.minecraft.world.World;
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
import java.util.List; import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
import WayofTime.alchemicalWizardry.common.omega.OmegaRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class EnergySword extends ItemSword public class EnergySword extends ItemSword
{ {
@ -75,11 +77,29 @@ public class EnergySword extends ItemSword
return this.passiveIcon; return this.passiveIcon;
} }
} }
private OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player)
{
return OmegaRegistry.getOmegaParadigmOfWeilder(player);
}
@Override @Override
public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{ {
return !getActivated(stack); boolean isActive = getActivated(stack);
if(isActive && !player.worldObj.isRemote)
{
OmegaParadigm parad = this.getOmegaParadigmOfWeilder(player);
if(parad != null && parad.isPlayerWearingFullSet(player))
{
if(!parad.onBoundSwordLeftClickEntity(stack, player, entity))
{
return true;
}
}
}
return !isActive;
} }
@Override @Override

View file

@ -9,6 +9,7 @@ import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm; import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
@ -19,6 +20,10 @@ public abstract class OmegaArmour extends BoundArmour
{ {
public OmegaParadigm paradigm; public OmegaParadigm paradigm;
public Reagent reagent; public Reagent reagent;
protected boolean storeBiomeID = false;
protected boolean storeDimensionID = false;
protected boolean storeYLevel = false;
protected boolean storeSeesSky = false;
public OmegaArmour(int armorType) public OmegaArmour(int armorType)
{ {
@ -30,6 +35,11 @@ public abstract class OmegaArmour extends BoundArmour
this.paradigm = paradigm; this.paradigm = paradigm;
} }
public OmegaParadigm getOmegaParadigm()
{
return this.paradigm;
}
public void setReagent(Reagent reagent) public void setReagent(Reagent reagent)
{ {
this.reagent = reagent; this.reagent = reagent;
@ -40,6 +50,28 @@ public abstract class OmegaArmour extends BoundArmour
{ {
super.onArmorTick(world, player, itemStack); super.onArmorTick(world, player, itemStack);
if(this.storeBiomeID())
{
int xCoord = (int) Math.floor(player.posX);
int zCoord = (int) Math.floor(player.posZ);
BiomeGenBase biome = world.getBiomeGenForCoords(xCoord, zCoord);
if(biome != null)
{
this.setBiomeIDStored(itemStack, biome.biomeID);
}
}
if(this.storeDimensionID())
{
this.setDimensionIDStored(itemStack, world.provider.dimensionId);
}
if(this.storeYLevel())
{
this.setYLevelStored(itemStack, (int) Math.floor(player.posY));
}
if(this.armorType == 1) if(this.armorType == 1)
{ {
paradigm.onUpdate(world, player, itemStack); paradigm.onUpdate(world, player, itemStack);
@ -222,4 +254,96 @@ public abstract class OmegaArmour extends BoundArmour
{ {
return this.getOmegaStallingDuration(stack) > 0; return this.getOmegaStallingDuration(stack) > 0;
} }
public boolean storeBiomeID()
{
return this.storeBiomeID;
}
public boolean storeDimensionID()
{
return this.storeDimensionID;
}
public boolean storeYLevel()
{
return this.storeYLevel;
}
public boolean storeSeesSky()
{
return this.storeSeesSky;
}
public int getBiomeIDStored(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
return tag.getInteger("biomeID");
}
public void setBiomeIDStored(ItemStack stack, int id)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
tag.setInteger("biomeID", id);
}
public int getDimensionIDStored(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
return tag.getInteger("dimensionID");
}
public void setDimensionIDStored(ItemStack stack, int id)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
tag.setInteger("dimensionID", id);
}
public int getYLevelStored(ItemStack stack)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
return tag.getInteger("yLevel");
}
public void setYLevelStored(ItemStack stack, int level)
{
NBTTagCompound tag = stack.getTagCompound();
if(tag == null)
{
tag = new NBTTagCompound();
stack.setTagCompound(tag);
}
tag.setInteger("yLevel", level);
}
} }

View file

@ -1,10 +1,18 @@
package WayofTime.alchemicalWizardry.common.items.armour; package WayofTime.alchemicalWizardry.common.items.armour;
import java.util.UUID;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.world.biome.BiomeGenBase;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWater; import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWater;
public class OmegaArmourWater extends OmegaArmour public class OmegaArmourWater extends OmegaArmour
@ -12,6 +20,7 @@ public class OmegaArmourWater extends OmegaArmour
public OmegaArmourWater(int armorType) public OmegaArmourWater(int armorType)
{ {
super(armorType); super(armorType);
this.storeBiomeID = true;
} }
@Override @Override
@ -33,4 +42,53 @@ public class OmegaArmourWater extends OmegaArmour
{ {
return new ModelOmegaWater(0.5f, false, false, true, false); return new ModelOmegaWater(0.5f, false, false, true, false);
} }
@Override
public Multimap getAttributeModifiers(ItemStack stack)
{
Multimap map = HashMultimap.create();
int biomeID = this.getBiomeIDStored(stack);
BiomeGenBase biome = BiomeGenBase.getBiome(biomeID);
if(biome != null)
{
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85312 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForBiome(biome), 0));
}
return map;
}
public float getDefaultHealthBoost()
{
switch(this.armorType)
{
case 0:
return 2.5f;
case 1:
return 4;
case 2:
return 3.5f;
case 3:
return 2;
}
return 0.25f;
}
public float getHealthBoostModifierForBiome(BiomeGenBase biome)
{
if(biome.isEqualTo(BiomeGenBase.hell))
{
return -0.5f;
}
if(biome.isEqualTo(BiomeGenBase.ocean))
{
return 2.0f;
}
if(biome.isHighHumidity())
{
return 1.5f;
}
return 0.5f;
}
} }

View file

@ -1,9 +1,17 @@
package WayofTime.alchemicalWizardry.common.items.armour; package WayofTime.alchemicalWizardry.common.items.armour;
import java.util.UUID;
import net.minecraft.client.model.ModelBiped; import net.minecraft.client.model.ModelBiped;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWind; import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWind;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly; import cpw.mods.fml.relauncher.SideOnly;
@ -12,6 +20,7 @@ public class OmegaArmourWind extends OmegaArmour
public OmegaArmourWind(int armorType) public OmegaArmourWind(int armorType)
{ {
super(armorType); super(armorType);
this.storeYLevel = true;
} }
@Override @Override
@ -33,4 +42,36 @@ public class OmegaArmourWind extends OmegaArmour
{ {
return new ModelOmegaWind(0.5f, false, false, true, false); return new ModelOmegaWind(0.5f, false, false, true, false);
} }
@Override
public Multimap getAttributeModifiers(ItemStack stack)
{
Multimap map = HashMultimap.create();
int yLevel = this.getYLevelStored(stack);
map.put(SharedMonsterAttributes.maxHealth.getAttributeUnlocalizedName(), new AttributeModifier(new UUID(85212 /** Random number **/, armorType), "Armor modifier" + armorType, getDefaultHealthBoost()*getHealthBoostModifierForLevel(yLevel), 0));
return map;
}
public float getDefaultHealthBoost()
{
switch(this.armorType)
{
case 0:
return 2.5f;
case 1:
return 4;
case 2:
return 3.5f;
case 3:
return 2;
}
return 0.25f;
}
public float getHealthBoostModifierForLevel(int yLevel)
{
return (float)Math.sqrt(((float)yLevel)/64f) * 1.5f - 1;
}
} }

View file

@ -133,4 +133,26 @@ public class OmegaParadigm
{ {
return false; return false;
} }
/**
*
* @param stack
* @param player
* @param entity
* @return False if it does not do damage
*/
public boolean onBoundSwordLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity)
{
return true;
}
public void onEmptyHandEntityInteract(EntityPlayer player, Entity entity)
{
}
public void onBoundSwordInteractWithEntity(EntityPlayer player, Entity entity)
{
}
} }

View file

@ -2,7 +2,10 @@ package WayofTime.alchemicalWizardry.common.omega;
import java.util.HashMap; import java.util.HashMap;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
import WayofTime.alchemicalWizardry.common.items.armour.OmegaArmour;
public class OmegaRegistry public class OmegaRegistry
{ {
@ -22,4 +25,18 @@ public class OmegaRegistry
{ {
return omegaList.containsKey(reagent); return omegaList.containsKey(reagent);
} }
public static OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player)
{
ItemStack[] armours = player.inventory.armorInventory;
ItemStack chestStack = armours[2];
if(chestStack != null && chestStack.getItem() instanceof OmegaArmour)
{
return ((OmegaArmour)chestStack.getItem()).getOmegaParadigm();
}
return null;
}
} }

View file

@ -43,7 +43,7 @@ public class RitualEffectOmegaTest extends RitualEffect
for(EntityPlayer player : playerList) for(EntityPlayer player : playerList)
{ {
Reagent reagent = ReagentRegistry.aquasalusReagent; Reagent reagent = ReagentRegistry.aetherReagent;
OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent); OmegaParadigm waterParadigm = OmegaRegistry.getParadigmForReagent(reagent);
waterParadigm.convertPlayerArmour(player); waterParadigm.convertPlayerArmour(player);