mirror of
https://github.com/KAMKEEL/CustomNPC-Plus.git
synced 2026-11-18 21:59:05 +00:00
Merge pull request #111 from Goodbird-git/screen-size
Implemented the ability to get the screen size from server
This commit is contained in:
6 files changed
+67
-1
No files matched your search
@@ -0,0 +1,38 @@
|
||||
package noppes.npcs.scripted;
|
||||
|
||||
import noppes.npcs.api.IScreenSize;
|
||||
|
||||
public class ScreenSize implements IScreenSize {
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
public ScreenSize(int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public void setSize(int width, int height) {
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWidthPercent(double percent) {
|
||||
return (int) (((double)width)*percent/100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHeightPercent(double percent) {
|
||||
return (int) (((double)height)*percent/100);
|
||||
}
|
||||
}
|
||||
@@ -679,6 +679,12 @@ public class ScriptPlayer<T extends EntityPlayerMP> extends ScriptLivingBase<T>
|
||||
return PlayerDataController.Instance.getPlayerData(player).timers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IScreenSize getScreenSize() {
|
||||
PlayerData data = PlayerDataController.Instance.getPlayerData(player);
|
||||
return data.getScreenSize() ;
|
||||
}
|
||||
|
||||
public void updatePlayerInventory() {
|
||||
((EntityPlayerMP)this.entity).inventoryContainer.detectAndSendChanges();
|
||||
PlayerData playerData = PlayerDataController.Instance.getPlayerData(player);
|
||||
|
||||
Reference in new issue
Block a user