Posted April 15, 20178 yr I am trying to create a darkened version of mycelium and I found that the vanilla MapColors are not the right color. I have no trouble making an instance of MapColor but it just appears transparent on the map. Util.java package drmeepster.evilshrooms.util; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import net.minecraft.block.material.MapColor; public final class Util { private Util(){} public static int getNextMapColor(){ //Will only be -1 if array is full int out = -1; for(int i = 0; i < MapColor.COLORS.length; i++){ if(MapColor.COLORS[i] == null){ continue; } out = i; break; } return out; } public static MapColor newMapColor(int index, int color){ Constructor<MapColor> constr; try{ constr = MapColor.class.getDeclaredConstructor(int.class, int.class); }catch (NoSuchMethodException | SecurityException e) { e.printStackTrace(); return null; } constr.setAccessible(true); try { return constr.newInstance(index, color); } catch (InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { e.printStackTrace(); return null; } } } ModEvilShrooms.java package drmeepster.evilshrooms; import drmeepster.evilshrooms.blocks.EvilShroomBlocks; import drmeepster.evilshrooms.util.TabEvilShroom; import drmeepster.evilshrooms.util.Util; import net.minecraft.block.material.MapColor; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = ModEvilShrooms.MODID, useMetadata = true, dependencies = "after:drcorester") public class ModEvilShrooms{ public static final String MODID = "evilshrooms"; public static final TabEvilShroom EVIL_SHROOM_TAB = new TabEvilShroom(); public static MapColor colorShadowMycelium; @EventHandler public void preInit(FMLPreInitializationEvent event){ colorShadowMycelium = Util.newMapColor(Util.getNextMapColor(), 0x281538); EvilShroomBlocks.preInit(); } @EventHandler public void init(FMLInitializationEvent event){ } @EventHandler public void postInit(FMLPostInitializationEvent event){ } } Edited April 15, 20178 yr by DrMeepster
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.