Skip to content

Commit

Permalink
fix error step 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Keriils committed Aug 23, 2024
1 parent ab1ff00 commit e66479c
Show file tree
Hide file tree
Showing 30 changed files with 494 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/main/resources/assets/nhutilities/lang/en_US.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
key.toggleTeleporterMKII=Toggle Enhanced Charm of Dislocation GUI
info.teleporterInfBaubles.txt=Support putting in-any-baubles
info.teleporterInfBaublesButton.txt=Support the use of-button-to open the baubles
item.NHUtilities:GluttonyRing.name=GluttonyRing
item.NHUtilities:HungerRing.name=HungerRing
item.NHUtilities:TimeVial.name=TimeVial
item.NHUtilities:EternityVial.name=EternityVial

# tooltips for time vial
text.NHUtilities.TimeVial.tips=§ftime: §6%d hours §d%d minutes §a%d seconds
text.NHUtilities.TimeVial.details_0=Possesses 6 acceleration gradients.
text.NHUtilities.TimeVial.details_1=Default adjustable range [4->128].
text.NHUtilities.TimeVial.details_2=Can be modified in the configuration to [8->256].
text.NHUtilities.TimeVial.details_3=Checks every 30 seconds if the player has multiple time vials.
text.NHUtilities.TimeVial.details_4=When multiples are present, executes time accumulation, adding the most time to one vial.
text.NHUtilities.TimeVial.details_5=While setting the remaining time vials to:
text.NHUtilities.TimeVial.details_6=Uh...114514. -11 hours -45 minutes -14 seconds.
text.NHUtilities.TimeVial.details_7=Can be modified without limits in the config file.
text.NHUtilities.TimeVial.details_8=The rules for GT machine acceleration are as follows:
text.NHUtilities.TimeVial.details_9=By default, the acceleration method is applied by accumulating ticks if Shift is not held down.
text.NHUtilities.TimeVial.details_10=Machines require processing time time and time must be >= 2 ticks.
text.NHUtilities.TimeVial.details_11=Executes time + acceleration multiplier * discount (default 0.8f), which is adjustable.
text.NHUtilities.TimeVial.details_12=In simple terms, adds the corresponding time to the machine's working time.
text.NHUtilities.TimeVial.details_13=Configuration file notes
text.NHUtilities.TimeVial.details_14=Allows adjusting the volume of the vial sounds and whether to enable number textures, i.e., 8x or 16x patterns.
text.NHUtilities.TimeVial.details_15=If unsure, do not modify. enableLogInfo = true

# tooltips for time vial
text.NHUtilities.EternityVial.details_0=Eternity

# information helper
infohelper.NHUtilities.txt_0=§6====§f[§dHold
infohelper.NHUtilities.txt_1=§dfor Details§f]§6====
infohelper.NHUtilities.key_ctrl=§bCtrl
infohelper.NHUtilities.key_shift=§bShift
35 changes: 35 additions & 0 deletions src/main/resources/assets/nhutilities/lang/zh_CN.lang
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
key.toggleTeleporterMKII=开关高级传送器GUI
info.teleporterInfBaubles.txt=支持放入-任意-饰品栏目
info.teleporterInfBaublesButton.txt=支持使用-按键-打开饰品
item.NHUtilities:GluttonyRing.name=暴食指环
item.NHUtilities:HungerRing.name=饥饿指环
item.NHUtilities:TimeVial.name=时间之瓶
item.NHUtilities:EternityVial.name=永恒之瓶

# tooltips for time vial
text.NHUtilities.TimeVial.tips=§f时间: §6%d 小时 §d%d 分钟 §a%d 秒
text.NHUtilities.TimeVial.details_0=拥有 6 个加速梯度
text.NHUtilities.TimeVial.details_1=默认可调整范围[4->128]
text.NHUtilities.TimeVial.details_2=可在配置修改为[8->256]
text.NHUtilities.TimeVial.details_3=间隔 30 秒检测一次玩家是否有多个时间瓶
text.NHUtilities.TimeVial.details_4=当有多个时执行 时间累加 添加最多时间的瓶子
text.NHUtilities.TimeVial.details_5=同时把其余时间瓶时间修改为:
text.NHUtilities.TimeVial.details_6=额..114514. -11 小时 -45 分钟 -14秒
text.NHUtilities.TimeVial.details_7=可在配置文件修改无限制
text.NHUtilities.TimeVial.details_8=GT机器加速的规则如下:
text.NHUtilities.TimeVial.details_9=如果不按住 shift 默认执行加速方法 tick累加
text.NHUtilities.TimeVial.details_10=即机器需要加工时间time且 time >= 2tick
text.NHUtilities.TimeVial.details_11=执行time + 加速倍率 * 折扣(默认0.8f) 可调整
text.NHUtilities.TimeVial.details_12=简单说就是给机器工作时间 加上相应的时间
text.NHUtilities.TimeVial.details_13=配置文件说明
text.NHUtilities.TimeVial.details_14=允许调整瓶子声音大小,是否启用数字贴图 即 8x 16x的图案
text.NHUtilities.TimeVial.details_15=如果不清楚请不要修改 enableLogInfo = true

# tooltips for time vial
text.NHUtilities.EternityVial.details_0=Eternity

# information helper
infohelper.NHUtilities.txt_0=§6====§f[§d按下
infohelper.NHUtilities.txt_1=§d显示更多信息§f]§6====
infohelper.NHUtilities.key_ctrl=§bCtrl
infohelper.NHUtilities.key_shift=§bShift
182 changes: 182 additions & 0 deletions src/main/resources/assets/nhutilities/shader/cosmic.frag
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
#version 120

#define M_PI 3.1415926535897932384626433832795

const int cosmiccount = 10;
const int cosmicoutof = 101;

uniform sampler2D texture0;
uniform vec3 lightlevel;

uniform float time2;

uniform float yaw;
uniform float pitch;
uniform float externalScale;

uniform float lightmix;
uniform float opacity;

uniform mat2 cosmicuvs[cosmiccount];

varying vec3 position;

float rand2d(vec2 x) {
return fract(sin(mod(dot(x, vec2(12.9898, 78.233)), 3.14)) * 43758.5453);
}

mat4 rotationMatrix(vec3 axis, float angle)
{

axis = normalize(axis);
float s = sin(angle);
float c = cos(angle);
float oc = 1.0 - c;

return mat4(oc * axis.x * axis.x + c, oc * axis.x * axis.y - axis.z * s, oc * axis.z * axis.x + axis.y * s, 0.0,
oc * axis.x * axis.y + axis.z * s, oc * axis.y * axis.y + c, oc * axis.y * axis.z - axis.x * s, 0.0,
oc * axis.z * axis.x - axis.y * s, oc * axis.y * axis.z + axis.x * s, oc * axis.z * axis.z + c, 0.0,
0.0, 0.0, 0.0, 1.0);
}

void main (void)
{
vec4 light = gl_Color;
vec4 mask = texture2D(texture0, gl_TexCoord[0].xy);
light.rgb *= lightlevel;
float correctTime = mod(time2,12000);

float oneOverExternalScale = 1.0/externalScale;

int uvtiles = 16;

// background colour
vec4 col = vec4(0.1,0.0,0.0,1.0);

float pulse = mod(correctTime,400)/400.0;

col.g = sin(pulse*M_PI*2) * 0.075 + 0.225;
col.b = cos(pulse*M_PI*2) * 0.05 + 0.3;

// get ray from camera to fragment
vec4 dir = normalize(vec4( -position, 0));

// rotate the ray to show the right bit of the sphere for the angle
float sb = sin(pitch);
float cb = cos(pitch);
dir = normalize(vec4(dir.x, dir.y * cb - dir.z * sb, dir.y * sb + dir.z * cb, 0));

float sa = sin(-yaw);
float ca = cos(-yaw);
dir = normalize(vec4(dir.z * sa + dir.x * ca, dir.y, dir.z * ca - dir.x * sa, 0));

vec4 ray;

// draw the layers
for (int i=0; i<16; i++) {
int mult = 16-i;

// get semi-random stuff
int j = i + 7;
float rand1 = (j * j * 4321 + j * 8) * 2.0;
int k = j + 1;
float rand2 = (k * k * k * 239 + k * 37) * 3.6;
float rand3 = rand1 * 347.4 + rand2 * 63.4;

// random rotation matrix by random rotation around random axis
vec3 axis = normalize(vec3(sin(rand1), sin(rand2) , cos(rand3)));

// apply
ray = dir * rotationMatrix(axis, mod(rand3, 2*M_PI));

// calcuate the UVs from the final ray
float rawu = 0.5 + (atan(ray.z,ray.x)/(2*M_PI));
float rawv = 0.5 + (asin(ray.y)/M_PI);

// get UV scaled for layers and offset by time;
float scale = mult*0.5 + 2.75;
float u = rawu * scale * externalScale;
//float v = (rawv + time * 0.00006) * scale * 0.6;
float v = (rawv + correctTime * 0.0002 * oneOverExternalScale) * scale * 0.6 * externalScale;

vec2 tex = vec2( u, v );

// tile position of the current uv
int tu = int(mod(floor(u*uvtiles),uvtiles));
int tv = int(mod(floor(v*uvtiles),uvtiles));

// get pseudorandom variants
int symbol = int(rand2d(vec2(tu, tv + i * 10.0)) * cosmicoutof);
int rotation = int(mod(pow(tu,float(tv)) + tu + 3 + tv*i, 8));
bool flip = false;
if (rotation >= 4) {
rotation -= 4;
flip = true;
}

// if it's an icon, then add the colour!
if (symbol >= 0 && symbol < cosmiccount) {

vec2 cosmictex = vec2(1.0,1.0);
vec4 tcol = vec4(1.0,0.0,0.0,1.0);

// get uv within the tile
float ru = clamp(mod(u,1.0)*uvtiles - tu, 0.0, 1.0);
float rv = clamp(mod(v,1.0)*uvtiles - tv, 0.0, 1.0);

if (flip) {
ru = 1.0 - ru;
}

float oru = ru;
float orv = rv;

// rotate uvs if necessary
if (rotation == 1) {
oru = 1.0-rv;
orv = ru;
} else if (rotation == 2) {
oru = 1.0-ru;
orv = 1.0-rv;
} else if (rotation == 3) {
oru = rv;
orv = 1.0-ru;
}

// get the iicon uvs for the tile
float umin = cosmicuvs[symbol][0][0];
float umax = cosmicuvs[symbol][1][0];
float vmin = cosmicuvs[symbol][0][1];
float vmax = cosmicuvs[symbol][1][1];

// interpolate based on tile uvs
cosmictex.x = umin * (1.0-oru) + umax * oru;
cosmictex.y = vmin * (1.0-orv) + vmax * orv;

tcol = texture2D(texture0, cosmictex);

// set the alpha, blending out at the bunched ends
float a = tcol.r * (0.5 + (1.0/mult) * 1.0) * (1.0-smoothstep(0.15, 0.48, abs(rawv-0.5)));

// get fancy colours
float r = (mod(rand1, 29.0)/29.0) * 0.3 + 0.4;
float g = (mod(rand2, 35.0)/35.0) * 0.4 + 0.6;
float b = (mod(rand1, 17.0)/17.0) * 0.3 + 0.7;

// mix the colours
//col = col*(1-a) + vec4(r,g,b,1)*a;
col = col + vec4(r,g,b,1)*a;
}
}

// apply lighting
vec3 shade = light.rgb * (lightmix) + vec3(1.0-lightmix,1.0-lightmix,1.0-lightmix);
col.rgb *= shade;

// apply mask
col.a *= mask.a * opacity;

col = clamp(col,0.0,1.0);

gl_FragColor = col;
}
Loading

0 comments on commit e66479c

Please sign in to comment.