Allow Bound Sword to be enchanted
Also changes how the models are handled and changing activation states does not cause the "item change" animation.
This commit is contained in:
parent
fd16a58b6b
commit
cc66af7eb1
15 changed files with 122 additions and 134 deletions
|
@ -0,0 +1,29 @@
|
|||
package WayofTime.bloodmagic.client.mesh;
|
||||
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IActivatable;
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class CustomMeshDefinitionActivatable implements ItemMeshDefinition
|
||||
{
|
||||
private final String name;
|
||||
|
||||
public CustomMeshDefinitionActivatable(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof IActivatable)
|
||||
{
|
||||
if (!((IActivatable) stack.getItem()).getActivated(stack))
|
||||
return new ModelResourceLocation(Constants.Mod.DOMAIN + name + "0", "inventory");
|
||||
|
||||
return new ModelResourceLocation(Constants.Mod.DOMAIN + name + "1", "inventory");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -1,25 +0,0 @@
|
|||
package WayofTime.bloodmagic.client.mesh;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraft.client.resources.model.ModelResourceLocation;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.item.soul.ItemSentientSword;
|
||||
|
||||
public class ItemSentientSwordMeshDefinition implements ItemMeshDefinition
|
||||
{
|
||||
@Override
|
||||
public ModelResourceLocation getModelLocation(ItemStack stack)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof ItemSentientSword)
|
||||
{
|
||||
if (((ItemSentientSword) stack.getItem()).getActivated(stack))
|
||||
{
|
||||
return new ModelResourceLocation("bloodmagic:ItemSentientSword1", "inventory");
|
||||
} else
|
||||
{
|
||||
return new ModelResourceLocation("bloodmagic:ItemSentientSword0", "inventory");
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue