Added an example item whose variants use the same textures but different colours for the layers.
This commit is contained in:
parent
f535e331dd
commit
dd6b5bd3b5
9 changed files with 209 additions and 25 deletions
|
@ -13,12 +13,15 @@ import WayofTime.bloodmagic.entity.projectile.EntityBloodLight;
|
|||
import WayofTime.bloodmagic.entity.projectile.EntityMeteor;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntitySentientArrow;
|
||||
import WayofTime.bloodmagic.entity.projectile.EntitySoulSnare;
|
||||
import WayofTime.bloodmagic.item.types.AlchemicTypes;
|
||||
import WayofTime.bloodmagic.soul.DemonWillHolder;
|
||||
import WayofTime.bloodmagic.tile.*;
|
||||
import WayofTime.bloodmagic.tile.routing.TileRoutingNode;
|
||||
import WayofTime.bloodmagic.util.BMLog;
|
||||
import WayofTime.bloodmagic.util.Constants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
|
@ -37,18 +40,22 @@ import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
|
|||
import java.awt.Color;
|
||||
import java.util.Map;
|
||||
|
||||
public class ClientProxy extends CommonProxy {
|
||||
public class ClientProxy extends CommonProxy
|
||||
{
|
||||
public static DemonWillHolder currentAura = new DemonWillHolder();
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
public void preInit()
|
||||
{
|
||||
super.preInit();
|
||||
|
||||
OBJLoader.INSTANCE.addDomain(BloodMagic.MODID);
|
||||
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR<TileInversionPillar>() {
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileInversionPillar.class, new AnimationTESR<TileInversionPillar>()
|
||||
{
|
||||
@Override
|
||||
public void handleEvents(TileInversionPillar chest, float time, Iterable<Event> pastEvents) {
|
||||
public void handleEvents(TileInversionPillar chest, float time, Iterable<Event> pastEvents)
|
||||
{
|
||||
chest.handleEvents(time, pastEvents);
|
||||
}
|
||||
});
|
||||
|
@ -66,7 +73,8 @@ public class ClientProxy extends CommonProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void registerRenderers() {
|
||||
public void registerRenderers()
|
||||
{
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySoulSnare.class, new SoulSnareRenderFactory());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntitySentientArrow.class, new SentientArrowRenderFactory());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityBloodLight.class, new BloodLightRenderFactory());
|
||||
|
@ -82,19 +90,24 @@ public class ClientProxy extends CommonProxy {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void init() {
|
||||
public void init()
|
||||
{
|
||||
super.init();
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
|
||||
try {
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) ->
|
||||
{
|
||||
try
|
||||
{
|
||||
if (stack.hasTagCompound() && stack.getTagCompound().hasKey(Constants.NBT.COLOR))
|
||||
if (tintIndex == 1)
|
||||
return Color.decode(stack.getTagCompound().getString(Constants.NBT.COLOR)).getRGB();
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException e)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}, RegistrarBloodMagicItems.SIGIL_HOLDING);
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) -> {
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) ->
|
||||
{
|
||||
if (tintIndex != 0 && tintIndex != 2)
|
||||
return -1;
|
||||
|
||||
|
@ -103,29 +116,43 @@ public class ClientProxy extends CommonProxy {
|
|||
|
||||
return PotionUtils.getPotionColorFromEffectList(PotionUtils.getEffectsFromStack(stack));
|
||||
}, RegistrarBloodMagicItems.POTION_FLASK);
|
||||
Minecraft.getMinecraft().getItemColors().registerItemColorHandler((stack, tintIndex) ->
|
||||
{
|
||||
// if (tintIndex != 0 && tintIndex != 2)
|
||||
// return -1;
|
||||
|
||||
int variant = stack.getMetadata();
|
||||
|
||||
return AlchemicTypes.getColourForLayer(variant, tintIndex);
|
||||
}, RegistrarBloodMagicItems.ALCHEMIC_VIAL);
|
||||
|
||||
addElytraLayer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postInit() {
|
||||
public void postInit()
|
||||
{
|
||||
Elements.createHUDElements();
|
||||
}
|
||||
|
||||
private void addElytraLayer() {
|
||||
private void addElytraLayer()
|
||||
{
|
||||
RenderManager renderManager = Minecraft.getMinecraft().getRenderManager();
|
||||
try {
|
||||
try
|
||||
{
|
||||
Map<String, RenderPlayer> skinMap = ObfuscationReflectionHelper.getPrivateValue(RenderManager.class, renderManager, "skinMap", "field_178636_l");
|
||||
skinMap.get("default").addLayer(new LayerBloodElytra(skinMap.get("default")));
|
||||
skinMap.get("slim").addLayer(new LayerBloodElytra(skinMap.get("slim")));
|
||||
BMLog.DEBUG.info("Elytra layer added");
|
||||
} catch (Exception e) {
|
||||
} catch (Exception e)
|
||||
{
|
||||
BMLog.DEBUG.error("Failed to set custom Elytra Layer for Elytra Living Armour Upgrade: {}", e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters) {
|
||||
public IAnimationStateMachine load(ResourceLocation location, ImmutableMap<String, ITimeValue> parameters)
|
||||
{
|
||||
return ModelLoaderRegistry.loadASM(location, parameters);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue