use of uk.co.wehavecookies56.kk.api.materials.Material in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class CommonProxy method init.
public void init(FMLInitializationEvent event) {
// Instance
MinecraftForge.EVENT_BUS.register(KingdomKeys.instance);
ModBiomes.init();
// ModSounds.init();
// LogHelper.info("Sounds loaded");
// Update checker
ModItems.init();
// Register renders
KingdomKeys.logger.info("Renders loaded");
// Tile entity registry
GameRegistry.registerTileEntity(TileEntitySynthesisTable.class, "synthesistable");
GameRegistry.registerTileEntity(TileEntityKKChest.class, "kkchest");
GameRegistry.registerTileEntity(TileEntityStationOfAwakening.class, "stationofawakening");
GameRegistry.registerTileEntity(TileEntityPedestal.class, "kkpedestal");
GameRegistry.registerTileEntity(TileEntityOrgPortal.class, "kkorgportal");
KingdomKeys.logger.info("Tile entity loaded");
// Proxy used as Gui handler
NetworkRegistry.INSTANCE.registerGuiHandler(KingdomKeys.instance, new GuiHandler());
EntityHelper.registerEntity("blastblox", EntityBlastBlox.class);
EntityHelper.registerEntity("fire", EntityFire.class);
EntityHelper.registerEntity("thunder", EntityThunder.class);
EntityHelper.registerEntity("kkOrgPortalE", EntityOrgPortal.class);
EntityHelper.registerEntity("kkFlyingHeart", EntityFlyingHeart.class);
// Heartless registry
EntityHelper.registerEntity(Strings.Shadow, EntityShadow.class, Color.BLACK.getRGB(), Color.YELLOW.getRGB());
EntityHelper.registerEntity(Strings.MegaShadow, EntityMegaShadow.class, Color.BLACK.getRGB(), Color.GRAY.getRGB());
EntityHelper.registerEntity(Strings.GigaShadow, EntityGigaShadow.class, Color.BLACK.getRGB(), Color.BLACK.getRGB());
EntityHelper.registerEntity(Strings.Darkball, EntityDarkball.class, 0x020030, 0x492263);
EntityHelper.registerEntity(Strings.RedNocturne, EntityRedNocturne.class, Color.RED.getRGB(), Color.PINK.getRGB());
EntityHelper.registerEntity(Strings.BlueRhapsody, EntityBlueRhapsody.class, Color.BLUE.getRGB(), Color.CYAN.getRGB());
EntityHelper.registerEntity(Strings.YellowOpera, EntityYellowOpera.class, Color.orange.getRGB(), Color.yellow.getRGB());
EntityHelper.registerEntity(Strings.GreenRequiem, EntityGreenRequiem.class, Color.LIGHT_GRAY.getRGB(), Color.green.getRGB());
EntityHelper.registerEntity(Strings.SilverRock, EntitySilverRock.class, Color.LIGHT_GRAY.getRGB(), Color.darkGray.getRGB());
EntityHelper.registerEntity(Strings.CrimsonJazz, EntityCrimsonJazz.class, Color.black.getRGB(), Color.red.getRGB());
EntityHelper.registerEntity(Strings.EmeraldBlues, EntityEmeraldBlues.class, Color.green.getRGB(), Color.blue.getRGB());
EntityHelper.registerEntity(Strings.MinuteBomb, EntityMinuteBomb.class, 0x020030, 0x8B4513);
EntityHelper.registerEntity(Strings.SkaterBomb, EntitySkaterBomb.class, 0x020030, 0xAAAAFF);
EntityHelper.registerEntity(Strings.StormBomb, EntityStormBomb.class, 0x020030, Color.CYAN.getRGB());
EntityHelper.registerEntity(Strings.Detonator, EntityDetonator.class, 0x020030, Color.RED.getRGB());
EntityHelper.registerEntity(Strings.LargeBody, EntityLargeBody.class, 0x4d177c, 0x29014c);
EntityHelper.registerEntity(Strings.Moogle, EntityMoogle.class, 0xDACAB0, 0xC50033);
EntityHelper.registerEntity(Strings.GummiShip, EntityGummiShip.class, 0xFF0000, 0x6666AA);
Spawnings.init();
Lists.init();
ModItemsRecipes.init();
// Drive forms init
ModDriveForms.init();
KingdomKeys.logger.info(DriveFormRegistry.getDriveFormMap().size() + " Drive form(s) loaded");
// Synthesis Recipes init
ModSynthesisRecipes.init();
KingdomKeys.logger.info(RecipeRegistry.getRecipeMap().size() + " Synthesis recipe(s) loaded");
ModSynthesisFreeDevRecipes.init();
KingdomKeys.logger.info(FreeDevRecipeRegistry.getFreeDevRecipeMap().size() + " Free Development recipe(s) loaded");
ModSynthesisMaterials.init();
KingdomKeys.logger.info(MaterialRegistry.getMaterialMap().size() + " Material(s) loaded");
Constants.registerCosts();
Constants.registerMagicLevels();
if (MainConfig.worldgen.EnableWorldGen) {
VillagerRegistry.instance().registerVillageCreationHandler(new MoogleHouse.VillageManager());
MapGenStructureIO.registerStructureComponent(MoogleHouse.class, Reference.MODID + ":moogle_house");
}
VillagerRegistry.VillagerProfession librarian = ForgeRegistries.VILLAGER_PROFESSIONS.getValue(new ResourceLocation("minecraft:librarian"));
librarian.getCareer(1).addTrade(1, new VillagerTrades());
// Chest loot init
MinecraftForge.EVENT_BUS.register(new ChestGen());
KingdomKeys.logger.info("Chest loot loaded");
}
use of uk.co.wehavecookies56.kk.api.materials.Material in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class GuiSynthesis method drawSelected.
public void drawSelected(int mouseX, int mouseY) {
SynthesisRecipeCapability.ISynthesisRecipe RECIPES = mc.player.getCapability(ModCapabilities.SYNTHESIS_RECIPES, null);
int posX = 220;
if (selected != -1) {
Minecraft.getMinecraft().renderEngine.bindTexture(optionsBackground);
drawGradientRect(posX - 10, 60, 700, height - ((height / 8) + 70 / 16), -1072689136, -804253680);
}
GL11.glPushMatrix();
{
for (int i = 0; i < RECIPES.getKnownRecipes().size(); i++) if (selected == i) {
float scale = 1.0f;
if (mc.gameSettings.guiScale == Constants.SCALE_LARGE) {
scale = 0.5f;
}
GL11.glPushMatrix();
{
GL11.glTranslatef(posX, 70, 0);
GL11.glScalef(2 * scale, 2 * scale, 2 * scale);
drawString(fontRenderer, Utils.translateToLocal(RECIPES.getKnownRecipes().get(i).toString() + ".name"), 0, 0, 0xFFF700);
Item item = ForgeRegistries.ITEMS.getValue(new ResourceLocation(Reference.MODID, RECIPES.getKnownRecipes().get(i).substring(5)));
if (item instanceof ItemKeyblade) {
drawString(fontRenderer, "Strength: +" + ((ItemKeyblade) ForgeRegistries.ITEMS.getValue(new ResourceLocation(Reference.MODID, RECIPES.getKnownRecipes().get(i).substring(5)))).getStrength(), 0, 10, 0xFF0000);
drawString(fontRenderer, "Magic: +" + ((ItemKeyblade) ForgeRegistries.ITEMS.getValue(new ResourceLocation(Reference.MODID, RECIPES.getKnownRecipes().get(i).substring(5)))).getMagic(), 0, 20, 0x4444FF);
} else if (item instanceof IOrgWeapon) {
drawString(fontRenderer, "Strength: +" + ((IOrgWeapon) ForgeRegistries.ITEMS.getValue(new ResourceLocation(Reference.MODID, RECIPES.getKnownRecipes().get(i).substring(5)))).getStrength(), 0, 10, 0xFF0000);
drawString(fontRenderer, "Magic: +" + ((IOrgWeapon) ForgeRegistries.ITEMS.getValue(new ResourceLocation(Reference.MODID, RECIPES.getKnownRecipes().get(i).substring(5)))).getMagic(), 0, 20, 0x4444FF);
}
}
GL11.glPopMatrix();
drawString(fontRenderer, Utils.translateToLocal(Strings.Gui_Synthesis_Main_Recipes_ReqMaterials) + TextFormatting.ITALIC, posX, 130, 0x00C3FF);
int row = 0;
int column = 0;
int materialLength = 0;
Iterator it = RecipeRegistry.get(RECIPES.getKnownRecipes().get(i)).getRequirements().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Material, Integer> pair = (Map.Entry<Material, Integer>) it.next();
int distY = (int) (24 * scale);
int distX = (int) (100 * scale);
GL11.glPushMatrix();
{
GL11.glColor4f(1, 1, 1, 1);
ResourceLocation synthMaterial = pair.getKey().getTexture();
if (synthMaterial == null) {
GL11.glTranslatef((int) (posX + (materialLength * 1.05f)), 140 + (distY * row), 0);
GL11.glScalef(scale, scale, 0);
Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(pair.getKey().getItem(), 0, 0);
} else {
mc.renderEngine.bindTexture(synthMaterial);
GL11.glTranslatef(posX + (materialLength * 1.05f * scale), 140 + (distY * row), 0);
GL11.glScalef(0.0625f * scale, 0.0625f * scale, 0);
drawTexturedModalRect(0, 0, 0, 0, 256, 256);
}
}
GL11.glPopMatrix();
String name = pair.getKey().getName();
String info = "";
int colour = 0xFFFFFF;
SynthesisMaterialCapability.ISynthesisMaterial MATS = mc.player.getCapability(ModCapabilities.SYNTHESIS_MATERIALS, null);
if (MATS.getKnownMaterialsMap().containsKey(pair.getKey().getName())) {
info = " - You have " + MATS.getKnownMaterialsMap().get(pair.getKey().getName());
if (MATS.getKnownMaterialsMap().get(pair.getKey().getName()) >= pair.getValue())
colour = 0x00CF18;
else
colour = 0xB50000;
} else {
info = " - You have 0";
colour = 0xB50000;
}
String material = Utils.translateToLocal(name + ".name") + " x" + pair.getValue();
GL11.glPushMatrix();
{
GL11.glTranslatef((int) (posX + 18 + (materialLength * 1.05f * scale)), 144 + (distY * row), 0);
GL11.glScalef(scale, scale, 0);
drawString(fontRenderer, material, 0, 0, 0xFFFFFF);
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
GL11.glTranslatef((int) (posX + 18 + (fontRenderer.getStringWidth(material) * scale) + (materialLength * 1.05f * scale)), 144 + (distY * row), 0);
GL11.glScalef(scale, scale, 0);
drawString(fontRenderer, info, 0, 0, colour);
}
GL11.glPopMatrix();
if (column == 1) {
row++;
column = 0;
materialLength = 0;
} else {
materialLength = (fontRenderer.getStringWidth(Utils.translateToLocal(ModItems.Chain_IncompleteKiblade.getUnlocalizedName() + ".name") + " - You have XXXX")) + 20;
column = 1;
}
}
}
}
GL11.glPopMatrix();
}
use of uk.co.wehavecookies56.kk.api.materials.Material in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class GuiSynthesis method isRecipeUsable.
public boolean isRecipeUsable(String name) {
EntityPlayer player = Minecraft.getMinecraft().player;
SynthesisMaterialCapability.ISynthesisMaterial MATS = player.getCapability(ModCapabilities.SYNTHESIS_MATERIALS, null);
Recipe r = RecipeRegistry.get(name);
List<Boolean> hasMaterials = new ArrayList<Boolean>();
if (isInventoryFull())
return false;
Iterator it = r.getRequirements().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Material, Integer> pair = (Map.Entry<Material, Integer>) it.next();
if (MATS.getKnownMaterialsMap().containsKey(pair.getKey().getName())) {
if (pair.getValue() != null && MATS.getKnownMaterialsMap().get(pair.getKey().getName()) != null) {
if (pair.getValue() <= MATS.getKnownMaterialsMap().get(pair.getKey().getName())) {
hasMaterials.add(true);
}
}
}
}
if (r.getRequirements().size() > 0) {
if (hasMaterials.size() == r.getRequirements().size()) {
return true;
}
}
return false;
}
use of uk.co.wehavecookies56.kk.api.materials.Material in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class GuiSynthesis method isFreeDevRecipeUsable.
public boolean isFreeDevRecipeUsable(String name) {
EntityPlayer player = Minecraft.getMinecraft().player;
SynthesisMaterialCapability.ISynthesisMaterial MATS = player.getCapability(ModCapabilities.SYNTHESIS_MATERIALS, null);
Recipe r = FreeDevRecipeRegistry.get(name);
List<Boolean> hasMaterials = new ArrayList<Boolean>();
if (isInventoryFull())
return false;
Iterator it = r.getRequirements().entrySet().iterator();
while (it.hasNext()) {
Map.Entry<Material, Integer> pair = (Map.Entry<Material, Integer>) it.next();
if (MATS.getKnownMaterialsMap().containsKey(pair.getKey().getName())) {
if (pair.getValue() != null && MATS.getKnownMaterialsMap().get(pair.getKey().getName()) != null) {
if (pair.getValue() <= MATS.getKnownMaterialsMap().get(pair.getKey().getName())) {
hasMaterials.add(true);
}
}
}
}
if (r.getRequirements().size() > 0) {
if (hasMaterials.size() == r.getRequirements().size()) {
return true;
}
}
return false;
}
use of uk.co.wehavecookies56.kk.api.materials.Material in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class GuiSynthesis method drawSelectedMaterial.
public void drawSelectedMaterial(int mouseX, int mouseY) {
SynthesisMaterialCapability.ISynthesisMaterial MATS = mc.player.getCapability(ModCapabilities.SYNTHESIS_MATERIALS, null);
if (materialSelected != -1) {
Minecraft.getMinecraft().renderEngine.bindTexture(optionsBackground);
drawGradientRect(190, 60, 500, height - ((height / 8) + 70 / 16), -1072689136, -804253680);
}
List<String> materials = new ArrayList<String>();
materials.addAll(MATS.getKnownMaterialsMap().keySet());
for (int i = 0; i < MATS.getKnownMaterialsMap().size(); i++) if (materialSelected == i) {
GL11.glPushMatrix();
{
GL11.glTranslatef(200, 70, 0);
GL11.glScalef(2, 2, 2);
drawString(fontRenderer, Utils.translateToLocal(materials.get(i).toString() + ".name") + " x" + MATS.getKnownMaterialsMap().get(materials.get(i)), 0, 0, 0xFFF700);
}
GL11.glPopMatrix();
Material m = MaterialRegistry.get(materials.get(i).toString());
if (m.getTexture() != null) {
GL11.glPushMatrix();
{
GL11.glColor3f(1, 1, 1);
ResourceLocation texture = m.getTexture();
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
GL11.glTranslatef(200, 100, 0);
GL11.glScalef(0.0625f, 0.0625f, 0.0625f);
GL11.glScalef(3, 3, 3);
drawTexturedModalRect(0, 0, 0, 0, 256, 256);
}
GL11.glPopMatrix();
} else {
GL11.glPushMatrix();
{
ItemStack item = m.getItem();
GL11.glTranslatef(200, 100, 0);
GL11.glScalef(3, 3, 3);
mc.getRenderItem().renderItemAndEffectIntoGUI(item, 0, 0);
}
GL11.glPopMatrix();
}
}
}
Aggregations