Fixed the last of the model errors

This commit is contained in:
Nicholas Ignoffo 2017-08-16 16:39:57 -07:00
parent 3b173ecf17
commit 37ec0582eb
36 changed files with 176 additions and 121 deletions

View file

@ -3,20 +3,24 @@ package WayofTime.bloodmagic.item.soul;
import WayofTime.bloodmagic.BloodMagic;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import WayofTime.bloodmagic.client.IMeshProvider;
import WayofTime.bloodmagic.item.armour.ItemSentientArmour;
import com.google.common.collect.Lists;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.ItemMeshDefinition;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.NonNullList;
import net.minecraft.util.*;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
public class ItemSentientArmourGem extends Item {
import javax.annotation.Nullable;
import java.util.List;
public class ItemSentientArmourGem extends Item implements IMeshProvider {
public ItemSentientArmourGem() {
super();
@ -53,19 +57,29 @@ public class ItemSentientArmourGem extends Item {
}
@SideOnly(Side.CLIENT)
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
boolean hasSentientArmour = false;
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
for (ItemStack armourStack : armourInventory) {
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour) {
hasSentientArmour = true;
@Override
public ItemMeshDefinition getMeshDefinition() {
return stack -> {
boolean flag = false;
NonNullList<ItemStack> armourInventory = Minecraft.getMinecraft().player.inventory.armorInventory;
for (ItemStack armourStack : armourInventory) {
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour) {
flag = true;
}
}
}
if (hasSentientArmour) {
return new ModelResourceLocation("bloodmagic:ItemSentientArmourGem1", "inventory");
}
return new ModelResourceLocation(stack.getItem().getRegistryName(), "type=" + (flag ? "" : "de") + "activated");
};
}
@Override
public List<String> getVariants() {
return Lists.newArrayList("type=activated", "type=deactivated");
}
@Nullable
@Override
public ResourceLocation getCustomLocation() {
return null;
}
}

View file

@ -297,7 +297,7 @@ public class ItemSentientAxe extends ItemAxe implements IDemonWillWeapon, IMeshP
@Override
@SideOnly(Side.CLIENT)
public ItemMeshDefinition getMeshDefinition() {
return new CustomMeshDefinitionMultiWill("ItemSentientAxe");
return new CustomMeshDefinitionMultiWill("sentient_axe");
}
@Nullable

View file

@ -7,9 +7,11 @@ import WayofTime.bloodmagic.api.iface.ISentientTool;
import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.core.RegistrarBloodMagicItems;
import WayofTime.bloodmagic.entity.mob.EntitySentientSpecter;
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
import com.google.common.collect.Lists;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
@ -32,10 +34,12 @@ import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import org.apache.commons.lang3.tuple.Pair;
import java.util.List;
import java.util.Locale;
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool//, IMeshProvider
public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentientTool, IVariantProvider//, IMeshProvider
{
public static int[] soulBracket = new int[]{16, 60, 200, 400, 1000};
public static double[] defaultDamageAdded = new double[]{0.25, 0.5, 0.75, 1, 1.25};
@ -248,6 +252,11 @@ public class ItemSentientBow extends ItemBow implements IMultiWillTool, ISentien
return super.onItemRightClick(world, player, hand);
}
@Override
public List<Pair<Integer, String>> getVariants() {
return Lists.newArrayList(Pair.of(0, "inventory"));
}
public EntityTippedArrow getArrowEntity(World world, ItemStack stack, EntityLivingBase target, EntityLivingBase user, float velocity) {
EnumDemonWillType type = this.getCurrentType(stack);

View file

@ -296,7 +296,7 @@ public class ItemSentientPickaxe extends ItemPickaxe implements IDemonWillWeapon
@Override
@SideOnly(Side.CLIENT)
public ItemMeshDefinition getMeshDefinition() {
return new CustomMeshDefinitionMultiWill("ItemSentientPickaxe");
return new CustomMeshDefinitionMultiWill("sentient_pickaxe");
}
@Nullable

View file

@ -297,7 +297,7 @@ public class ItemSentientShovel extends ItemSpade implements IDemonWillWeapon, I
@Override
@SideOnly(Side.CLIENT)
public ItemMeshDefinition getMeshDefinition() {
return new CustomMeshDefinitionMultiWill("ItemSentientShovel");
return new CustomMeshDefinitionMultiWill("sentient_shovel");
}
@Nullable

View file

@ -272,7 +272,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon, IM
@Override
@SideOnly(Side.CLIENT)
public ItemMeshDefinition getMeshDefinition() {
return new CustomMeshDefinitionMultiWill("ItemSentientSword");
return new CustomMeshDefinitionMultiWill("sentient_shovel");
}
@Nullable

View file

@ -61,7 +61,7 @@ public class ItemSoulGem extends Item implements IDemonWillGem, IMeshProvider, I
@Override
@SideOnly(Side.CLIENT)
public ItemMeshDefinition getMeshDefinition() {
return new CustomMeshDefinitionWillGem("ItemSoulGem");
return new CustomMeshDefinitionWillGem("soul_gem");
}
@Nullable