mirror of
https://github.com/GTNewHorizons/Avaritia.git
synced 2026-11-25 22:44:33 +00:00
Dancing Around Mojang's Private Variables
This commit is contained in:
1 parent
151d29865c
commit
8d33b6b298
4 files changed
+103
-46
No files matched your search
@@ -4,6 +4,7 @@ import fox.spiteful.avaritia.Avaritia;
|
||||
import fox.spiteful.avaritia.Lumberjack;
|
||||
import fox.spiteful.avaritia.render.ModelArmorInfinity;
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
import fox.spiteful.avaritia.PotionHelper;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -11,6 +12,8 @@ import net.minecraft.item.EnumAction;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ISpecialArmor;
|
||||
import net.minecraftforge.common.util.EnumHelper;
|
||||
@@ -19,12 +22,15 @@ import org.apache.logging.log4j.Level;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
public class ItemArmorInfinity extends ItemArmor {
|
||||
|
||||
public static final ArmorMaterial infinite_armor = EnumHelper.addArmorMaterial("infinity", 9999, new int[]{6, 16, 12, 6}, 1000);
|
||||
public static final ModelArmorInfinity armorModel = new ModelArmorInfinity(1.0f);
|
||||
public static final ModelArmorInfinity legModel = new ModelArmorInfinity(0.5f);
|
||||
|
||||
|
||||
public ItemArmorInfinity(int slot){
|
||||
super(infinite_armor, 0, slot);
|
||||
setCreativeTab(Avaritia.tab);
|
||||
@@ -46,6 +52,7 @@ public class ItemArmorInfinity extends ItemArmor {
|
||||
super.setDamage(stack, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
if(armorType == 0){
|
||||
@@ -55,6 +62,22 @@ public class ItemArmorInfinity extends ItemArmor {
|
||||
}
|
||||
else if(armorType == 1){
|
||||
player.capabilities.allowFlying = true;
|
||||
Collection effects = player.getActivePotionEffects();
|
||||
if(effects.size() > 0){
|
||||
ArrayList<Potion> bad = new ArrayList<Potion>();
|
||||
for(Object effect : effects){
|
||||
if(effect instanceof PotionEffect){
|
||||
PotionEffect potion = (PotionEffect)effect;
|
||||
if(PotionHelper.badPotion(Potion.potionTypes[potion.getPotionID()]))
|
||||
bad.add(Potion.potionTypes[potion.getPotionID()]);
|
||||
}
|
||||
}
|
||||
if(bad.size() > 0){
|
||||
for(Potion potion : bad){
|
||||
player.removePotionEffect(potion.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(armorType == 2){
|
||||
if(player.isBurning())
|
||||
@@ -67,50 +90,50 @@ public class ItemArmorInfinity extends ItemArmor {
|
||||
{
|
||||
return LudicrousItems.cosmic;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot){
|
||||
ModelArmorInfinity model = armorSlot == 2 ? legModel : armorModel;
|
||||
|
||||
model.bipedHead.showModel = armorSlot == 0;
|
||||
model.bipedHeadwear.showModel = armorSlot == 0;
|
||||
model.bipedBody.showModel = armorSlot == 1;
|
||||
model.bipedRightArm.showModel = armorSlot == 1;
|
||||
model.bipedLeftArm.showModel = armorSlot == 1;
|
||||
model.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
model.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
|
||||
model.isSneak = entityLiving.isSneaking();
|
||||
model.isRiding = entityLiving.isRiding();
|
||||
model.isChild = entityLiving.isChild();
|
||||
|
||||
model.heldItemRight = 0;
|
||||
model.aimedBow = false;
|
||||
|
||||
EntityPlayer player = (EntityPlayer)entityLiving;
|
||||
|
||||
ItemStack held_item = player.getEquipmentInSlot(0);
|
||||
|
||||
if (held_item != null){
|
||||
model.heldItemRight = 1;
|
||||
|
||||
if (player.getItemInUseCount() > 0){
|
||||
|
||||
EnumAction enumaction = held_item.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.bow){
|
||||
model.aimedBow = true;
|
||||
}else if (enumaction == EnumAction.block){
|
||||
model.heldItemRight = 3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemstack, int armorSlot){
|
||||
ModelArmorInfinity model = armorSlot == 2 ? legModel : armorModel;
|
||||
|
||||
model.bipedHead.showModel = armorSlot == 0;
|
||||
model.bipedHeadwear.showModel = armorSlot == 0;
|
||||
model.bipedBody.showModel = armorSlot == 1;
|
||||
model.bipedRightArm.showModel = armorSlot == 1;
|
||||
model.bipedLeftArm.showModel = armorSlot == 1;
|
||||
model.bipedRightLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
model.bipedLeftLeg.showModel = armorSlot == 2 || armorSlot == 3;
|
||||
|
||||
model.isSneak = entityLiving.isSneaking();
|
||||
model.isRiding = entityLiving.isRiding();
|
||||
model.isChild = entityLiving.isChild();
|
||||
|
||||
model.heldItemRight = 0;
|
||||
model.aimedBow = false;
|
||||
|
||||
EntityPlayer player = (EntityPlayer)entityLiving;
|
||||
|
||||
ItemStack held_item = player.getEquipmentInSlot(0);
|
||||
|
||||
if (held_item != null){
|
||||
model.heldItemRight = 1;
|
||||
|
||||
if (player.getItemInUseCount() > 0){
|
||||
|
||||
EnumAction enumaction = held_item.getItemUseAction();
|
||||
|
||||
if (enumaction == EnumAction.bow){
|
||||
model.aimedBow = true;
|
||||
}else if (enumaction == EnumAction.block){
|
||||
model.heldItemRight = 3;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return model;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user