Begin new model system
Includes some examples for both ways.
This commit is contained in:
parent
5c2ba20a32
commit
ba0b24d231
28 changed files with 332 additions and 104 deletions
19
src/main/java/WayofTime/bloodmagic/client/IMeshProvider.java
Normal file
19
src/main/java/WayofTime/bloodmagic/client/IMeshProvider.java
Normal file
|
@ -0,0 +1,19 @@
|
|||
package WayofTime.bloodmagic.client;
|
||||
|
||||
import net.minecraft.client.renderer.ItemMeshDefinition;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Provides a custom {@link ItemMeshDefinition} for automatic registration of
|
||||
* renders.
|
||||
*/
|
||||
public interface IMeshProvider {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
ItemMeshDefinition getMeshDefinition();
|
||||
|
||||
List<String> getVariants();
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
package WayofTime.bloodmagic.client;
|
||||
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface IVariantProvider {
|
||||
|
||||
List<Pair<Integer, String>> getVariants();
|
||||
}
|
|
@ -5,6 +5,7 @@ import net.minecraft.client.resources.model.ModelResourceLocation;
|
|||
import net.minecraft.item.ItemStack;
|
||||
import WayofTime.bloodmagic.api.Constants;
|
||||
import WayofTime.bloodmagic.api.iface.IActivatable;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class CustomMeshDefinitionActivatable implements ItemMeshDefinition
|
||||
{
|
||||
|
@ -18,12 +19,9 @@ public class CustomMeshDefinitionActivatable implements ItemMeshDefinition
|
|||
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");
|
||||
if (((IActivatable) stack.getItem()).getActivated(stack))
|
||||
return new ModelResourceLocation(new ResourceLocation(Constants.Mod.MODID, "item/" + name), "active=true");
|
||||
|
||||
return new ModelResourceLocation(Constants.Mod.DOMAIN + name + "1", "inventory");
|
||||
}
|
||||
return null;
|
||||
return new ModelResourceLocation(new ResourceLocation(Constants.Mod.MODID, "item/" + name), "active=false");
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue