use of uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class SyncDriveData method process.
@Override
public void process(EntityPlayer player, Side side) {
final IDriveState state = player.getCapability(ModCapabilities.DRIVE_STATE, null);
state.setInDrive(inDrive);
state.setActiveDriveName(driveName);
state.setAntiPoints(antiPoints);
state.setDriveLevel(Strings.Form_Valor, valorLevel);
state.setDriveLevel(Strings.Form_Wisdom, wisdomLevel);
state.setDriveLevel(Strings.Form_Limit, limitLevel);
state.setDriveLevel(Strings.Form_Master, masterLevel);
state.setDriveLevel(Strings.Form_Final, finalLevel);
state.setDriveExp(Strings.Form_Valor, valorExp);
state.setDriveExp(Strings.Form_Wisdom, wisdomExp);
state.setDriveExp(Strings.Form_Limit, limitExp);
state.setDriveExp(Strings.Form_Master, masterExp);
state.setDriveExp(Strings.Form_Final, finalExp);
state.setDriveGaugeLevel(driveGaugeLevel);
state.setDP(dp);
state.setFP(fp);
state.getMessages().clear();
for (int i = 0; i < this.messages.size(); i++) {
state.getMessages().add(this.messages.get(i));
}
}
use of uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class CapabilityEvents method onEntityConstructing.
@SubscribeEvent
public void onEntityConstructing(AttachCapabilitiesEvent<Entity> event) {
if (event.getObject() instanceof EntityPlayer) {
event.addCapability(new ResourceLocation(Reference.MODID, "IOrganizationXIII"), new ICapabilitySerializable<NBTTagCompound>() {
OrganizationXIIICapability.IOrganizationXIII inst = ModCapabilities.ORGANIZATION_XIII.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, @Nullable EnumFacing facing) {
return capability == ModCapabilities.ORGANIZATION_XIII;
}
@Override
public <T> T getCapability(Capability<T> capability, @Nullable EnumFacing facing) {
return capability == ModCapabilities.ORGANIZATION_XIII ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.ORGANIZATION_XIII.getStorage().writeNBT(ModCapabilities.ORGANIZATION_XIII, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.ORGANIZATION_XIII.getStorage().readNBT(ModCapabilities.ORGANIZATION_XIII, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "IMunny"), new ICapabilitySerializable<NBTPrimitive>() {
MunnyCapability.IMunny inst = ModCapabilities.MUNNY.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.MUNNY;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.MUNNY ? (T) inst : null;
}
@Override
public NBTPrimitive serializeNBT() {
return (NBTPrimitive) ModCapabilities.MUNNY.getStorage().writeNBT(ModCapabilities.MUNNY, inst, null);
}
@Override
public void deserializeNBT(NBTPrimitive nbt) {
ModCapabilities.MUNNY.getStorage().readNBT(ModCapabilities.MUNNY, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "ICheatMode"), new ICapabilitySerializable<NBTPrimitive>() {
CheatModeCapability.ICheatMode inst = ModCapabilities.CHEAT_MODE.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.CHEAT_MODE;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.CHEAT_MODE ? (T) inst : null;
}
@Override
public NBTPrimitive serializeNBT() {
return (NBTPrimitive) ModCapabilities.CHEAT_MODE.getStorage().writeNBT(ModCapabilities.CHEAT_MODE, inst, null);
}
@Override
public void deserializeNBT(NBTPrimitive nbt) {
ModCapabilities.CHEAT_MODE.getStorage().readNBT(ModCapabilities.CHEAT_MODE, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "IPlayerStats"), new ICapabilitySerializable<NBTTagCompound>() {
PlayerStatsCapability.IPlayerStats inst = ModCapabilities.PLAYER_STATS.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.PLAYER_STATS;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.PLAYER_STATS ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.PLAYER_STATS.getStorage().writeNBT(ModCapabilities.PLAYER_STATS, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.PLAYER_STATS.getStorage().readNBT(ModCapabilities.PLAYER_STATS, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "ISummonKeyblade"), new ICapabilitySerializable<NBTTagCompound>() {
SummonKeybladeCapability.ISummonKeyblade inst = ModCapabilities.SUMMON_KEYBLADE.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.SUMMON_KEYBLADE;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.SUMMON_KEYBLADE ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.SUMMON_KEYBLADE.getStorage().writeNBT(ModCapabilities.SUMMON_KEYBLADE, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.SUMMON_KEYBLADE.getStorage().readNBT(ModCapabilities.SUMMON_KEYBLADE, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "IMagicState"), new ICapabilitySerializable<NBTTagCompound>() {
MagicStateCapability.IMagicState inst = ModCapabilities.MAGIC_STATE.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.MAGIC_STATE;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.MAGIC_STATE ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.MAGIC_STATE.getStorage().writeNBT(ModCapabilities.MAGIC_STATE, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.MAGIC_STATE.getStorage().readNBT(ModCapabilities.MAGIC_STATE, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "IDriveState"), new ICapabilitySerializable<NBTTagCompound>() {
DriveStateCapability.IDriveState inst = ModCapabilities.DRIVE_STATE.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.DRIVE_STATE;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.DRIVE_STATE ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.DRIVE_STATE.getStorage().writeNBT(ModCapabilities.DRIVE_STATE, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.DRIVE_STATE.getStorage().readNBT(ModCapabilities.DRIVE_STATE, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "IFirstTimeJoin"), new ICapabilitySerializable<NBTTagCompound>() {
FirstTimeJoinCapability.IFirstTimeJoin inst = ModCapabilities.FIRST_TIME_JOIN.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.FIRST_TIME_JOIN;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.FIRST_TIME_JOIN ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.FIRST_TIME_JOIN.getStorage().writeNBT(ModCapabilities.FIRST_TIME_JOIN, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.FIRST_TIME_JOIN.getStorage().readNBT(ModCapabilities.FIRST_TIME_JOIN, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "ISynthesisRecipe"), new ICapabilitySerializable<NBTTagCompound>() {
SynthesisRecipeCapability.ISynthesisRecipe inst = ModCapabilities.SYNTHESIS_RECIPES.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.SYNTHESIS_RECIPES;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.SYNTHESIS_RECIPES ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.SYNTHESIS_RECIPES.getStorage().writeNBT(ModCapabilities.SYNTHESIS_RECIPES, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.SYNTHESIS_RECIPES.getStorage().readNBT(ModCapabilities.SYNTHESIS_RECIPES, inst, null, nbt);
}
});
event.addCapability(new ResourceLocation(Reference.MODID, "ISynthesisMaterial"), new ICapabilitySerializable<NBTTagCompound>() {
SynthesisMaterialCapability.ISynthesisMaterial inst = ModCapabilities.SYNTHESIS_MATERIALS.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing) {
return capability == ModCapabilities.SYNTHESIS_MATERIALS;
}
@SuppressWarnings("unchecked")
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing) {
return capability == ModCapabilities.SYNTHESIS_MATERIALS ? (T) inst : null;
}
@Override
public NBTTagCompound serializeNBT() {
return (NBTTagCompound) ModCapabilities.SYNTHESIS_MATERIALS.getStorage().writeNBT(ModCapabilities.SYNTHESIS_MATERIALS, inst, null);
}
@Override
public void deserializeNBT(NBTTagCompound nbt) {
ModCapabilities.SYNTHESIS_MATERIALS.getStorage().readNBT(ModCapabilities.SYNTHESIS_MATERIALS, inst, null, nbt);
}
});
}
}
use of uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class ItemEvents method onEntityItemPickUp.
@SubscribeEvent
public void onEntityItemPickUp(EntityItemPickupEvent event) {
IPlayerStats STATS = event.getEntityPlayer().getCapability(ModCapabilities.PLAYER_STATS, null);
IDriveState DRIVE = event.getEntityPlayer().getCapability(ModCapabilities.DRIVE_STATE, null);
if (event.getItem().getItem().getItem() instanceof ItemMunny) {
final MunnyCapability.IMunny munny = event.getEntityPlayer().getCapability(ModCapabilities.MUNNY, null);
MunnyPickup packet = new MunnyPickup(event.getItem().getItem());
event.getItem().getItem().setCount(event.getItem().getItem().getCount() - 1);
;
munny.addMunny(event.getItem().getItem().getTagCompound().getInteger("amount"));
PacketDispatcher.sendTo(new SyncMunnyData(munny), (EntityPlayerMP) event.getEntityPlayer());
PacketDispatcher.sendTo(new ShowOverlayPacket("munny", event.getItem().getItem().getTagCompound().getInteger("amount")), (EntityPlayerMP) event.getEntityPlayer());
} else if (event.getItem().getItem().getItem() instanceof ItemHpOrb) {
if (!ItemStack.areItemStacksEqual(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND), ItemStack.EMPTY))
if (event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.EmptyBottle)
return;
HpOrbPickup packet = new HpOrbPickup(event.getItem().getItem());
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
if (event.getEntityPlayer().getHealth() >= event.getEntityPlayer().getMaxHealth()) {
event.getItem().getItem().setCount(event.getItem().getItem().getCount() - 1);
;
return;
}
if (event.getEntityPlayer().getHealth() < event.getEntityPlayer().getMaxHealth() - 1)
event.getEntityPlayer().heal(2);
else
event.getEntityPlayer().heal(1);
event.getItem().getItem().setCount(event.getItem().getItem().getCount() - 1);
;
}
} else if (event.getItem().getItem().getItem() == ModItems.DriveOrb) {
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
event.getItem().getItem().setCount(event.getItem().getItem().getCount() - 1);
;
DRIVE.addDP(event.getItem().getItem().getTagCompound().getInteger("amount"));
EntityPlayer player = event.getEntityPlayer();
PacketDispatcher.sendTo(new SyncDriveData(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) player);
PacketDispatcher.sendTo(new SyncDriveInventory(player.getCapability(ModCapabilities.DRIVE_STATE, null)), (EntityPlayerMP) event.getEntityPlayer());
}
} else if (event.getItem().getItem().getItem() == ModItems.MagicOrb) {
double mp = STATS.getMP();
if (!ItemStack.areItemStacksEqual(event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND), ItemStack.EMPTY))
if (event.getEntityPlayer().getHeldItem(EnumHand.MAIN_HAND).getItem() == ModItems.EmptyBottle)
return;
if (FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER) {
event.getItem().getItem().setCount(event.getItem().getItem().getCount() - 1);
;
STATS.addMP(event.getItem().getItem().getTagCompound().getInteger("amount"));
PacketDispatcher.sendTo(new SyncMagicData(event.getEntityPlayer().getCapability(ModCapabilities.MAGIC_STATE, null), STATS), (EntityPlayerMP) event.getEntityPlayer());
}
} else if (event.getItem().getItem().getItem() instanceof ItemSynthesisMaterial) {
for (int i = 0; i < event.getEntityPlayer().inventory.getSizeInventory(); i++) {
if (!ItemStack.areItemStacksEqual(event.getEntityPlayer().inventory.getStackInSlot(i), ItemStack.EMPTY)) {
if (event.getEntityPlayer().inventory.getStackInSlot(i).getItem() == ModItems.SynthesisBagL) {
IItemHandler inv = event.getEntityPlayer().inventory.getStackInSlot(i).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
addSynthesisMaterialToBag(inv, event);
} else if (event.getEntityPlayer().inventory.getStackInSlot(i).getItem() == ModItems.SynthesisBagM) {
IItemHandler inv = event.getEntityPlayer().inventory.getStackInSlot(i).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
addSynthesisMaterialToBag(inv, event);
}
if (event.getEntityPlayer().inventory.getStackInSlot(i).getItem() == ModItems.SynthesisBagS) {
IItemHandler inv = event.getEntityPlayer().inventory.getStackInSlot(i).getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, null);
addSynthesisMaterialToBag(inv, event);
}
}
}
}
}
use of uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class DriveFormWisdom method getXP.
@SubscribeEvent
public static void getXP(LivingDeathEvent event) {
if (!event.getEntity().world.isRemote && event.getEntity() instanceof IKHMob) {
if (event.getSource().getTrueSource() instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) event.getSource().getTrueSource();
IDriveState DRIVE = player.getCapability(ModCapabilities.DRIVE_STATE, null);
if (DRIVE.getActiveDriveName().equals(Strings.Form_Wisdom)) {
DRIVE.setDriveExp(DRIVE.getActiveDriveName(), DRIVE.getDriveExp(DRIVE.getActiveDriveName()) + 1);
int[] costs = DriveFormRegistry.get(DRIVE.getActiveDriveName()).getExpCosts();
int actualLevel = DRIVE.getDriveLevel(DRIVE.getActiveDriveName());
int actualExp = DRIVE.getDriveExp(DRIVE.getActiveDriveName());
if (costs.length == 7 && actualLevel < 7) {
if (actualExp >= costs[actualLevel]) {
System.out.println("LEVEL UP");
DRIVE.setDriveLevel(DRIVE.getActiveDriveName(), actualLevel + 1);
DRIVE.displayLevelUpMessage(player, DRIVE.getActiveDriveName());
}
}
PacketDispatcher.sendTo(new SyncDriveData(DRIVE), (EntityPlayerMP) player);
}
}
}
}
use of uk.co.wehavecookies56.kk.common.capability.DriveStateCapability.IDriveState in project Kingdom-Keys-Re-Coded by Wehavecookies56.
the class GuiCommandMenu method drawCommandMenu.
public void drawCommandMenu(int width, int height) {
int extraY = 0;
if (Minecraft.getMinecraft().player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getMember() != Utils.OrgMember.NONE) {
extraY = 45;
}
int alpha = MainConfig.client.hud.guiAlpha;
EntityPlayer player = Minecraft.getMinecraft().player;
IDriveState DS = mc.player.getCapability(ModCapabilities.DRIVE_STATE, null);
PlayerStatsCapability.IPlayerStats STATS = mc.player.getCapability(ModCapabilities.PLAYER_STATS, null);
this.spells = new ArrayList<String>();
this.items = new ArrayList<String>();
this.driveCommands = new ArrayList<String>();
this.portalCommands = new ArrayList<PortalCoords>();
this.spells.clear();
for (int i = 0; i < player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getStackInSlot(i), ItemStack.EMPTY))
this.spells.add(((ItemSpellOrb) Minecraft.getMinecraft().player.getCapability(ModCapabilities.MAGIC_STATE, null).getInventorySpells().getStackInSlot(i).getItem()).getMagicName());
this.items.clear();
for (int i = 0; i < player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(i), ItemStack.EMPTY))
this.items.add(((ItemKKPotion) Minecraft.getMinecraft().player.getCapability(ModCapabilities.PLAYER_STATS, null).getInventoryPotionsMenu().getStackInSlot(i).getItem()).getUnlocalizedName().substring(5));
this.driveCommands.clear();
for (int i = 0; i < player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getSlots(); i++) if (!ItemStack.areItemStacksEqual(Minecraft.getMinecraft().player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i), ItemStack.EMPTY))
this.driveCommands.add(((ItemDriveForm) Minecraft.getMinecraft().player.getCapability(ModCapabilities.DRIVE_STATE, null).getInventoryDriveForms().getStackInSlot(i).getItem()).getDriveFormName());
this.portalCommands.clear();
for (byte i = 0; i < 3; i++) {
PortalCoords coords = player.getCapability(ModCapabilities.ORGANIZATION_XIII, null).getPortalCoords(i);
// System.out.println(i+" "+coords);
if (coords != null) {
if (!(coords.getX() == 0 && coords.getY() == 0 && coords.getZ() == 0)) {
this.portalCommands.add(coords);
}
}
}
float scale = 1.05f;
int colour;
// DRIVE
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v = 0;
int x = 0;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * DRIVE), 0);
GL11.glScalef(scale, scale, scale);
if (submenu != 0)
GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
if (selected == DRIVE) {
// Selected
textX = 5;
if (EntityEvents.isHostiles)
drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
} else {
// Not selected
textX = 0;
if (EntityEvents.isHostiles)
drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
}
if (this.submenu == 0) {
if (DS.getInDrive()) {
if (DS.getActiveDriveName().equals(Strings.Form_Anti))
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive_Revert), 6 + textX, 4, 0x888888);
else
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive_Revert), 6 + textX, 4, 0xFFFFFF);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
} else if (this.driveCommands.isEmpty() || DS.getDP() <= 0) {
if (extraY == 45)
// 0xFFFFFF
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Limit), 6 + textX, 4, 0x888888);
else
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive), 6 + textX, 4, 0x888888);
} else {
if (extraY == 45)
// 0xFFFFFF
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Limit), 6 + textX, 4, 0x888888);
else
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive), 6 + textX, 4, 0xFFFFFF);
}
}
}
GL11.glPopMatrix();
// ITEMS
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v = 0;
int x = 0;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * ITEMS), 0);
GL11.glScalef(scale, scale, scale);
if (submenu != 0)
GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
if (selected == ITEMS) {
// Selected
textX = 5;
if (EntityEvents.isHostiles)
drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
} else {
// Not selected
textX = 0;
if (EntityEvents.isHostiles)
drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
}
if (this.submenu == 0) {
if (this.items.isEmpty())
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Items), 6 + textX, 4, 0x888888);
else
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Items), 6 + textX, 4, 0xFFFFFF);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
GL11.glPopMatrix();
// MAGIC
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v = 0;
int x = 0;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * MAGIC), 0);
GL11.glScalef(scale, scale, scale);
if (submenu != 0)
GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
if (selected == MAGIC) {
// Selected
textX = 5;
if (EntityEvents.isHostiles)
drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
} else {
// Not selected
textX = 0;
if (EntityEvents.isHostiles)
drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
}
if (this.submenu == 0) {
int color;
if (spells == null) {
color = 0x888888;
} else {
if (!STATS.getRecharge() && (!this.spells.isEmpty() && !DS.getActiveDriveName().equals(Strings.Form_Valor)))
color = 0xFFFFFF;
else
color = 0x888888;
}
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Magic), 6 + textX, 4, color);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
GL11.glPopMatrix();
// ATTACK
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v = 0;
int x = 0;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * ATTACK), 0);
GL11.glScalef(scale, scale, scale);
if (submenu != 0)
GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
if (selected == ATTACK) {
// Selected
textX = 5;
if (EntityEvents.isHostiles)
drawTexturedModalRect(5, 0, TOP_WIDTH, 30 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(5, 0, TOP_WIDTH, MENU_HEIGHT + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
} else {
// Not selected
textX = 0;
if (EntityEvents.isHostiles)
drawTexturedModalRect(0, 0, 0, 30, TOP_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
}
if (this.submenu == 0) {
int color = this.portalCommands.isEmpty() || STATS.getRecharge() ? 0x888888 : 0xFFFFFF;
if (extraY == 45)
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Portal), 6 + textX, 4, color);
else
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Attack), 6 + textX, 4, color);
}
}
GL11.glPopMatrix();
// TOP
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(0, (height - MENU_HEIGHT * scale * TOP), 0);
GL11.glScalef(scale, scale, scale);
if (submenu != 0)
GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
if (EntityEvents.isHostiles)
drawTexturedModalRect(0, 0, 0, 15, TOP_WIDTH, TOP_HEIGHT);
else
drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
if (this.submenu == 0) {
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Command), 6, 4, 0xFFFFFF);
}
}
GL11.glPopMatrix();
// Portal submenu //
if (portalCommands == null) {
} else if (!portalCommands.isEmpty()) {
// PORTAL TOP
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (portalCommands.size() + 1)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_PORTALS) {
drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Portals_Title), 6, 4, 0xFFFFFF);
}
}
GL11.glPopMatrix();
for (int i = 0; i < portalCommands.size(); i++) {
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v;
int x;
x = (portalSelected == i) ? 10 : 5;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (portalCommands.size() - i)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_PORTALS) {
v = 0;
if (portalSelected == i)
drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
// colour = Constants.getCost(spells.get(i)) < STATS.getMP() ? 0xFFFFFF : 0xFF9900;
PortalCoords portal = portalCommands.get(i);
// String magicName = Constants.getMagicName(magic, level);
drawString(mc.fontRenderer, Utils.translateToLocal(portal.getShortCoords() + ""), 6, 4, 0xFFFFFF);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
GL11.glPopMatrix();
}
}
// Magic submenu //
if (spells == null) {
} else if (!spells.isEmpty()) {
// MAGIC TOP
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (spells.size() + 1)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_MAGIC) {
drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Magic_Title), 6, 4, 0xFFFFFF);
}
}
GL11.glPopMatrix();
for (int i = 0; i < spells.size(); i++) {
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v;
int x;
x = (magicselected == i) ? 10 : 5;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (spells.size() - i)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_MAGIC) {
v = 0;
if (magicselected == i)
drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
colour = Constants.getCost(spells.get(i)) < STATS.getMP() ? 0xFFFFFF : 0xFF9900;
if (spells.get(i).equals(Strings.Spell_Cure))
colour = 0xFF9900;
colour = STATS.getMP() < 1 ? 0x888888 : colour;
String magic = spells.get(i);
int level = mc.player.getCapability(ModCapabilities.MAGIC_STATE, null).getMagicLevel(magic);
String magicName = Constants.getMagicName(magic, level);
drawString(mc.fontRenderer, Utils.translateToLocal(magicName), 6, 4, colour);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
GL11.glPopMatrix();
}
}
// Items submenu //
if (items == null) {
} else if (!items.isEmpty()) {
// Items TOP
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (items.size() + 1)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_ITEMS) {
drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
drawString(mc.fontRenderer, Utils.translateToLocal("ITEMS"), 6, 4, 0xFFFFFF);
}
}
GL11.glPopMatrix();
for (int i = 0; i < items.size(); i++) {
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v;
int x;
x = (potionselected == i) ? 10 : 5;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (items.size() - i)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_ITEMS) {
v = 0;
if (potionselected == i)
drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
drawString(mc.fontRenderer, Utils.translateToLocal("item." + items.get(i) + ".name"), 6, 4, 0xFFFFFF);
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
}
GL11.glPopMatrix();
}
}
// Drive form submenu //
if (driveCommands == null) {
} else if (!driveCommands.isEmpty()) {
// DRIVE TOP
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (driveCommands.size() + 1)), 0);
GL11.glScalef(1.25f, scale, scale);
if (submenu == SUB_DRIVE)
drawTexturedModalRect(0, 0, 0, 0 + extraY, TOP_WIDTH, TOP_HEIGHT);
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
GL11.glTranslatef(5, (height - MENU_HEIGHT * scale * (driveCommands.size() + 1)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_DRIVE)
drawString(mc.fontRenderer, Utils.translateToLocal(Strings.Gui_CommandMenu_Drive_Title), 6, 4, 0xFFFFFF);
}
GL11.glPopMatrix();
for (int i = 0; i < driveCommands.size(); i++) {
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 255, (byte) 255, (byte) 255, (byte) alpha);
int u;
int v;
int x;
x = (driveselected == i) ? 10 : 5;
v = (driveselected == i) ? MENU_HEIGHT : 0;
mc.renderEngine.bindTexture(texture);
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (driveCommands.size() - i)), 0);
GL11.glScalef(1.25f, scale, scale);
if (submenu == SUB_DRIVE) {
v = 0;
if (driveselected == i)
drawTexturedModalRect(0, 0, TOP_WIDTH, 15 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
else
drawTexturedModalRect(0, 0, TOP_WIDTH, 0 + extraY, TOP_WIDTH + MENU_WIDTH, v + MENU_HEIGHT);
}
}
GL11.glPopMatrix();
GL11.glPushMatrix();
{
GL11.glColor4ub((byte) 80, (byte) 80, (byte) 80, (byte) alpha);
int x;
x = (driveselected == i) ? 10 : 5;
GL11.glTranslatef(x, (height - MENU_HEIGHT * scale * (driveCommands.size() - i)), 0);
GL11.glScalef(scale, scale, scale);
if (submenu == SUB_DRIVE) {
if (DS.getDP() >= Constants.getCost(driveCommands.get(i)) || mc.player.getCapability(ModCapabilities.CHEAT_MODE, null).getCheatMode())
drawString(mc.fontRenderer, Utils.translateToLocal(driveCommands.get(i)), 6, 4, 0xFFFFFF);
else
drawString(mc.fontRenderer, Utils.translateToLocal(driveCommands.get(i)), 6, 4, 0x888888);
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
}
GL11.glPopMatrix();
}
}
}
Aggregations