Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public int[] interpolateLight(IWorld world, int x, int y){
- IGameInstance game = RockBottomAPI.getGame();
- if(game.isLightDebug()){
- return new int[]{Constants.MAX_LIGHT, Constants.MAX_LIGHT, Constants.MAX_LIGHT, Constants.MAX_LIGHT};
- }
- else if(!game.getSettings().smoothLighting){
- int light = world.getCombinedLight(x, y);
- return new int[]{light, light, light, light};
- }
- else{
- Direction[] dirs = Direction.SURROUNDING_INCLUDING_NONE;
- byte[] lightAround = new byte[dirs.length];
- for(int i = 0; i < dirs.length; i++){
- Direction dir = dirs[i];
- if(world.isPosLoaded(x+dir.x, y+dir.y)){
- lightAround[i] = world.getCombinedLight(x+dir.x, y+dir.y);
- }
- }
- int[] light = new int[4];
- light[Image.TOP_LEFT] = (lightAround[0]+lightAround[8]+lightAround[1]+lightAround[2])/4;
- light[Image.TOP_RIGHT] = (lightAround[0]+lightAround[2]+lightAround[3]+lightAround[4])/4;
- light[Image.BOTTOM_RIGHT] = (lightAround[0]+lightAround[4]+lightAround[5]+lightAround[6])/4;
- light[Image.BOTTOM_LEFT] = (lightAround[0]+lightAround[6]+lightAround[7]+lightAround[8])/4;
- return light;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement