Initiating Omega protocol.
This commit is contained in:
parent
beab450a62
commit
fd437fb4ca
26 changed files with 1934 additions and 37 deletions
|
@ -67,7 +67,7 @@ public class CheatyItem extends Item implements IBindable
|
|||
SpellHelper.sendIndexedParticleToAllAround(world, posX, posY, posZ, 20, world.provider.dimensionId, 4, posX, posY, posZ);
|
||||
}
|
||||
|
||||
if (!par3EntityPlayer.worldObj.isRemote)
|
||||
if (par3EntityPlayer.worldObj.isRemote)
|
||||
{
|
||||
return par1ItemStack;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package WayofTime.alchemicalWizardry.common.items;
|
||||
package WayofTime.alchemicalWizardry.common.items.armour;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
@ -27,6 +27,8 @@ import WayofTime.alchemicalWizardry.ModItems;
|
|||
import WayofTime.alchemicalWizardry.api.alchemy.energy.IAlchemyGoggles;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.ArmourUpgrade;
|
||||
import WayofTime.alchemicalWizardry.api.items.interfaces.IBindable;
|
||||
import WayofTime.alchemicalWizardry.common.items.EnergyItems;
|
||||
import WayofTime.alchemicalWizardry.common.items.ILPGauge;
|
||||
import WayofTime.alchemicalWizardry.common.items.sigil.DivinationSigil;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaArmour;
|
||||
import cpw.mods.fml.common.Optional;
|
|
@ -0,0 +1,206 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.armour;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler;
|
||||
import WayofTime.alchemicalWizardry.common.omega.OmegaParadigm;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class OmegaArmour extends BoundArmour
|
||||
{
|
||||
public OmegaParadigm paradigm;
|
||||
|
||||
public OmegaArmour(int armorType)
|
||||
{
|
||||
super(armorType);
|
||||
}
|
||||
|
||||
public void setParadigm(OmegaParadigm paradigm)
|
||||
{
|
||||
this.paradigm = paradigm;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
if(!this.decrementDuration(itemStack))
|
||||
{
|
||||
ItemStack stack = this.getContainedArmourStack(itemStack);
|
||||
player.inventory.armorInventory[3-this.armorType] = stack;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getSubstituteStack(ItemStack boundStack)
|
||||
{
|
||||
ItemStack omegaStack = new ItemStack(this);
|
||||
this.setContainedArmourStack(omegaStack, boundStack);
|
||||
SoulNetworkHandler.checkAndSetItemOwner(omegaStack, SoulNetworkHandler.getOwnerName(boundStack));
|
||||
this.setItemDuration(omegaStack, 100);
|
||||
return omegaStack;
|
||||
}
|
||||
|
||||
public void setContainedArmourStack(ItemStack omegaStack, ItemStack boundStack)
|
||||
{
|
||||
if(omegaStack == null || boundStack == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
boundStack.writeToNBT(tag);
|
||||
|
||||
NBTTagCompound omegaTag = omegaStack.getTagCompound();
|
||||
if(omegaTag == null)
|
||||
{
|
||||
omegaTag = new NBTTagCompound();
|
||||
omegaStack.setTagCompound(omegaTag);
|
||||
}
|
||||
|
||||
omegaTag.setTag("armour", tag);
|
||||
}
|
||||
|
||||
public ItemStack getContainedArmourStack(ItemStack omegaStack)
|
||||
{
|
||||
NBTTagCompound omegaTag = omegaStack.getTagCompound();
|
||||
if(omegaTag == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
NBTTagCompound tag = omegaTag.getCompoundTag("armour");
|
||||
ItemStack armourStack = ItemStack.loadItemStackFromNBT(tag);
|
||||
|
||||
return armourStack;
|
||||
}
|
||||
|
||||
public void setItemDuration(ItemStack omegaStack, int duration)
|
||||
{
|
||||
NBTTagCompound tag = omegaStack.getTagCompound();
|
||||
if(tag == null)
|
||||
{
|
||||
tag = new NBTTagCompound();
|
||||
omegaStack.setTagCompound(tag);
|
||||
}
|
||||
|
||||
tag.setInteger("duration", duration);
|
||||
}
|
||||
|
||||
public int getDuration(ItemStack omegaStack)
|
||||
{
|
||||
if(omegaStack.hasTagCompound())
|
||||
{
|
||||
return omegaStack.getTagCompound().getInteger("duration");
|
||||
}else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param omegaStack
|
||||
* @return true if there is duration left (duration > 0)
|
||||
*/
|
||||
public boolean decrementDuration(ItemStack omegaStack)
|
||||
{
|
||||
int duration = this.getDuration(omegaStack);
|
||||
|
||||
if(duration > 0)
|
||||
{
|
||||
this.setItemDuration(omegaStack, duration - 1);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
return "alchemicalwizardry:models/armor/OmegaWater.png";
|
||||
}
|
||||
|
||||
public abstract ModelBiped getChestModel();
|
||||
|
||||
public abstract ModelBiped getLegsModel();
|
||||
|
||||
ModelBiped model1 = null;
|
||||
ModelBiped model2 = null;
|
||||
ModelBiped model = null;
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
if (tryComplexRendering)
|
||||
{
|
||||
int type = ((ItemArmor) itemStack.getItem()).armorType;
|
||||
if (this.model1 == null)
|
||||
{
|
||||
this.model1 = getChestModel();
|
||||
}
|
||||
if (this.model2 == null)
|
||||
{
|
||||
this.model2 = getLegsModel();
|
||||
}
|
||||
|
||||
if (type == 1 || type == 3 || type == 0)
|
||||
{
|
||||
this.model = model1;
|
||||
} else
|
||||
{
|
||||
this.model = model2;
|
||||
}
|
||||
|
||||
if (this.model != null)
|
||||
{
|
||||
this.model.bipedHead.showModel = (type == 0);
|
||||
this.model.bipedHeadwear.showModel = (type == 0);
|
||||
this.model.bipedBody.showModel = ((type == 1) || (type == 2));
|
||||
this.model.bipedLeftArm.showModel = (type == 1);
|
||||
this.model.bipedRightArm.showModel = (type == 1);
|
||||
this.model.bipedLeftLeg.showModel = (type == 2 || type == 3);
|
||||
this.model.bipedRightLeg.showModel = (type == 2 || type == 3);
|
||||
this.model.isSneak = entityLiving.isSneaking();
|
||||
|
||||
this.model.isRiding = entityLiving.isRiding();
|
||||
this.model.isChild = entityLiving.isChild();
|
||||
|
||||
this.model.aimedBow = false;
|
||||
this.model.heldItemRight = (entityLiving.getHeldItem() != null ? 1 : 0);
|
||||
|
||||
if ((entityLiving instanceof EntityPlayer))
|
||||
{
|
||||
if (((EntityPlayer) entityLiving).getItemInUseDuration() > 0)
|
||||
{
|
||||
EnumAction enumaction = ((EntityPlayer) entityLiving).getItemInUse().getItemUseAction();
|
||||
if (enumaction == EnumAction.block)
|
||||
{
|
||||
this.model.heldItemRight = 3;
|
||||
} else if (enumaction == EnumAction.bow)
|
||||
{
|
||||
this.model.aimedBow = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return model;
|
||||
|
||||
} else
|
||||
{
|
||||
return super.getArmorModel(entityLiving, itemStack, armorSlot);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.armour;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaEarth;
|
||||
|
||||
public class OmegaArmourEarth extends OmegaArmour
|
||||
{
|
||||
public OmegaArmourEarth(int armorType)
|
||||
{
|
||||
super(armorType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
return "alchemicalwizardry:models/armor/OmegaEarth.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getChestModel()
|
||||
{
|
||||
return new ModelOmegaEarth(1.0f, true, true, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getLegsModel()
|
||||
{
|
||||
return new ModelOmegaEarth(0.5f, false, false, true, false);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.armour;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWater;
|
||||
|
||||
public class OmegaArmourWater extends OmegaArmour
|
||||
{
|
||||
public OmegaArmourWater(int armorType)
|
||||
{
|
||||
super(armorType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
return "alchemicalwizardry:models/armor/OmegaWater.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getChestModel()
|
||||
{
|
||||
return new ModelOmegaWater(1.0f, true, true, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getLegsModel()
|
||||
{
|
||||
return new ModelOmegaWater(0.5f, false, false, true, false);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
package WayofTime.alchemicalWizardry.common.items.armour;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.alchemicalWizardry.common.renderer.model.ModelOmegaWind;
|
||||
|
||||
public class OmegaArmourWind extends OmegaArmour
|
||||
{
|
||||
public OmegaArmourWind(int armorType)
|
||||
{
|
||||
super(armorType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
return "alchemicalwizardry:models/armor/OmegaWind.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getChestModel()
|
||||
{
|
||||
return new ModelOmegaWind(1.0f, true, true, false, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelBiped getLegsModel()
|
||||
{
|
||||
return new ModelOmegaWind(0.5f, false, false, true, false);
|
||||
}
|
||||
}
|
|
@ -133,11 +133,16 @@ public class ItemHarvestSigil extends EnergyItems implements IHolding, ArmourUpg
|
|||
@Override
|
||||
public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5)
|
||||
{
|
||||
if (!(par3Entity instanceof EntityPlayer) || par2World.isRemote)
|
||||
if ((!(par3Entity instanceof EntityPlayer)) || par2World.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if(par2World.isRemote)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
EntityPlayer par3EntityPlayer = (EntityPlayer) par3Entity;
|
||||
|
||||
if (par1ItemStack.stackTagCompound == null)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue