use of mcjty.lib.preferences.PlayerPreferencesProperties in project RFTools by McJty.
the class FMLEventHandlers method onPlayerTickEvent.
@SubscribeEvent
public void onPlayerTickEvent(TickEvent.PlayerTickEvent event) {
if (event.phase == TickEvent.Phase.START && !event.player.worldObj.isRemote) {
IExtendedEntityProperties properties = event.player.getExtendedProperties(PlayerExtendedProperties.ID);
if (properties instanceof PlayerExtendedProperties) {
PlayerExtendedProperties playerExtendedProperties = (PlayerExtendedProperties) properties;
playerExtendedProperties.tick();
}
properties = event.player.getExtendedProperties(PlayerPreferencesProperties.ID);
if (properties instanceof PlayerPreferencesProperties) {
PlayerPreferencesProperties preferencesProperties = (PlayerPreferencesProperties) properties;
preferencesProperties.tick(RFToolsMessages.INSTANCE);
}
}
}
use of mcjty.lib.preferences.PlayerPreferencesProperties in project RFTools by McJty.
the class RenderGameOverlayEventHandler method renderBuffs.
private static void renderBuffs() {
if (buffs == null || buffs.isEmpty()) {
return;
}
EntityClientPlayerMP player = Minecraft.getMinecraft().thePlayer;
PlayerPreferencesProperties properties = PlayerPreferencesProperties.getProperties(player);
int x = properties.getPreferencesProperties().getBuffX();
int y = properties.getPreferencesProperties().getBuffY();
if (x == -1 || y == -1) {
return;
}
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
GL11.glDisable(GL11.GL_LIGHTING);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
for (PlayerBuff buff : buffs) {
Item item;
switch(buff) {
case BUFF_FEATHERFALLING:
item = EnvironmentalSetup.featherFallingEModuleItem;
break;
case BUFF_FEATHERFALLINGPLUS:
item = EnvironmentalSetup.featherFallingPlusEModuleItem;
break;
case BUFF_HASTE:
item = EnvironmentalSetup.hasteEModuleItem;
break;
case BUFF_HASTEPLUS:
item = EnvironmentalSetup.hastePlusEModuleItem;
break;
case BUFF_REGENERATION:
item = EnvironmentalSetup.regenerationEModuleItem;
break;
case BUFF_REGENERATIONPLUS:
item = EnvironmentalSetup.regenerationPlusEModuleItem;
break;
case BUFF_SATURATION:
item = EnvironmentalSetup.saturationEModuleItem;
break;
case BUFF_SATURATIONPLUS:
item = EnvironmentalSetup.saturationPlusEModuleItem;
break;
case BUFF_SPEED:
item = EnvironmentalSetup.speedEModuleItem;
break;
case BUFF_SPEEDPLUS:
item = EnvironmentalSetup.speedPlusEModuleItem;
break;
case BUFF_FLIGHT:
item = EnvironmentalSetup.flightEModuleItem;
break;
case BUFF_PEACEFUL:
item = EnvironmentalSetup.peacefulEModuleItem;
break;
case BUFF_WATERBREATHING:
item = EnvironmentalSetup.waterBreathingEModuleItem;
break;
case BUFF_NIGHTVISION:
item = EnvironmentalSetup.nightVisionEModuleItem;
break;
case BUFF_BLINDNESS:
item = EnvironmentalSetup.blindnessEModuleItem;
break;
case BUFF_WEAKNESS:
item = EnvironmentalSetup.weaknessEModuleItem;
break;
case BUFF_POISON:
item = EnvironmentalSetup.poisonEModuleItem;
break;
case BUFF_SLOWNESS:
item = EnvironmentalSetup.slownessEModuleItem;
break;
default:
item = null;
}
if (item != null) {
IIcon icon = item.getIconFromDamage(0);
RenderHelper.renderIcon(Minecraft.getMinecraft(), itemRender, icon, x, y, false);
x += BUFF_ICON_SIZE;
}
}
}
use of mcjty.lib.preferences.PlayerPreferencesProperties in project RFTools by McJty.
the class CmdSetBuffBar method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length > 3) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
if (!(sender instanceof EntityPlayer)) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command only works as a player!"));
return;
}
EntityPlayer player = (EntityPlayer) sender;
PlayerPreferencesProperties properties = PlayerPreferencesProperties.getProperties(player);
if (args.length < 3) {
int buffX = properties.getPreferencesProperties().getBuffX();
int buffY = properties.getPreferencesProperties().getBuffY();
((EntityPlayer) sender).addChatComponentMessage(new ChatComponentText(EnumChatFormatting.YELLOW + "Current buffbar location: " + buffX + "," + buffY));
return;
}
int x = fetchInt(sender, args, 1, 0);
int y = fetchInt(sender, args, 2, 0);
properties.getPreferencesProperties().setBuffXY(x, y);
}
use of mcjty.lib.preferences.PlayerPreferencesProperties in project RFTools by McJty.
the class CmdReset method execute.
@Override
public void execute(ICommandSender sender, String[] args) {
if (args.length > 1) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "Too many parameters!"));
return;
}
if (!(sender instanceof EntityPlayer)) {
sender.addChatMessage(new ChatComponentText(EnumChatFormatting.RED + "This command only works as a player!"));
return;
}
EntityPlayer player = (EntityPlayer) sender;
PlayerPreferencesProperties properties = PlayerPreferencesProperties.getProperties(player);
properties.getPreferencesProperties().reset();
}
use of mcjty.lib.preferences.PlayerPreferencesProperties in project RFTools by McJty.
the class ForgeEventHandlers method onEntityConstructingEvent.
@SubscribeEvent
public void onEntityConstructingEvent(EntityEvent.EntityConstructing event) {
if (event.entity instanceof EntityPlayer) {
PlayerExtendedProperties properties = new PlayerExtendedProperties();
event.entity.registerExtendedProperties(PlayerExtendedProperties.ID, properties);
PlayerPreferencesProperties preferencesProperties = (PlayerPreferencesProperties) event.entity.getExtendedProperties(PlayerPreferencesProperties.ID);
if (preferencesProperties == null) {
preferencesProperties = new PlayerPreferencesProperties();
event.entity.registerExtendedProperties(PlayerPreferencesProperties.ID, preferencesProperties);
}
}
}
Aggregations