More base-work on Omega
This commit is contained in:
parent
d7d8aedd42
commit
18d07baad3
10 changed files with 336 additions and 30 deletions
|
@ -1,8 +1,7 @@
|
|||
package WayofTime.alchemicalWizardry.common.items;
|
||||
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
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.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import java.util.List;
|
||||
import WayofTime.alchemicalWizardry.AlchemicalWizardry;
|
||||
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
|
||||
{
|
||||
|
@ -75,11 +77,29 @@ public class EnergySword extends ItemSword
|
|||
return this.passiveIcon;
|
||||
}
|
||||
}
|
||||
|
||||
private OmegaParadigm getOmegaParadigmOfWeilder(EntityPlayer player)
|
||||
{
|
||||
return OmegaRegistry.getOmegaParadigmOfWeilder(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
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
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.item.ItemArmor;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.biome.BiomeGenBase;
|
||||
import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
|
||||
|
@ -19,6 +20,10 @@ public abstract class OmegaArmour extends BoundArmour
|
|||
{
|
||||
public OmegaParadigm paradigm;
|
||||
public Reagent reagent;
|
||||
protected boolean storeBiomeID = false;
|
||||
protected boolean storeDimensionID = false;
|
||||
protected boolean storeYLevel = false;
|
||||
protected boolean storeSeesSky = false;
|
||||
|
||||
public OmegaArmour(int armorType)
|
||||
{
|
||||
|
@ -30,6 +35,11 @@ public abstract class OmegaArmour extends BoundArmour
|
|||
this.paradigm = paradigm;
|
||||
}
|
||||
|
||||
public OmegaParadigm getOmegaParadigm()
|
||||
{
|
||||
return this.paradigm;
|
||||
}
|
||||
|
||||
public void setReagent(Reagent reagent)
|
||||
{
|
||||
this.reagent = reagent;
|
||||
|
@ -40,6 +50,28 @@ public abstract class OmegaArmour extends BoundArmour
|
|||
{
|
||||
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)
|
||||
{
|
||||
paradigm.onUpdate(world, player, itemStack);
|
||||
|
@ -222,4 +254,96 @@ public abstract class OmegaArmour extends BoundArmour
|
|||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,10 +1,18 @@
|
|||
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.SideOnly;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
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.world.biome.BiomeGenBase;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWater;
|
||||
|
||||
public class OmegaArmourWater extends OmegaArmour
|
||||
|
@ -12,6 +20,7 @@ public class OmegaArmourWater extends OmegaArmour
|
|||
public OmegaArmourWater(int armorType)
|
||||
{
|
||||
super(armorType);
|
||||
this.storeBiomeID = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,4 +42,53 @@ public class OmegaArmourWater extends OmegaArmour
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,17 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.armour;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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.SideOnly;
|
||||
|
||||
|
@ -12,6 +20,7 @@ public class OmegaArmourWind extends OmegaArmour
|
|||
public OmegaArmourWind(int armorType)
|
||||
{
|
||||
super(armorType);
|
||||
this.storeYLevel = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -33,4 +42,36 @@ public class OmegaArmourWind extends OmegaArmour
|
|||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue