Skip to content

Commit e877dda

Browse files
authored
Merge pull request #79 from MCPfannkuchenYT/dev
Release 2.0.3 for LoTAS 1.7.10 to 1.19
2 parents 571a959 + d9f327e commit e877dda

File tree

56 files changed

+734
-464
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+734
-464
lines changed

LoTAS-Fabric/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import groovy.json.JsonOutput
22

3-
version = "2.0.2"
3+
version = "2.0.3"
44
group = "de.pfannekuchen.lotas"
55

66
apply from: 'versions2/preprocessor.gradle'

LoTAS-Fabric/settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ def versions2 = [
1616
'1.16.1',
1717
'1.16.5',
1818
'1.17.1',
19-
'1.18.1',
20-
'1.18.2'
19+
'1.18.2',
20+
'1.19.0'
2121
]
2222
versions2.collect {":versions2:$it"}.each {
2323
include it

LoTAS-Fabric/src/main/java/de/pfannekuchen/lotas/core/MCVer.java

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
package de.pfannekuchen.lotas.core;
22

3+
import com.mojang.blaze3d.platform.GlStateManager;
34
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
45
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
6+
import com.mojang.blaze3d.vertex.BufferBuilder;
7+
import com.mojang.blaze3d.vertex.DefaultVertexFormat;
8+
import com.mojang.blaze3d.vertex.Tesselator;
59
import com.mojang.math.Quaternion;
610

711
import de.pfannekuchen.lotas.mixin.accessors.AccessorButtons;
@@ -18,6 +22,7 @@
1822
import net.minecraft.client.gui.screens.Screen;
1923
import net.minecraft.client.renderer.blockentity.BlockEntityRenderDispatcher;
2024
import net.minecraft.client.renderer.texture.TextureManager;
25+
import net.minecraft.network.chat.Component;
2126
import net.minecraft.resources.ResourceLocation;
2227
import net.minecraft.server.level.ServerLevel;
2328
import net.minecraft.world.entity.Entity;
@@ -40,7 +45,7 @@ public class MCVer {
4045
//$$ }
4146
//$$ public static void setMessage(AbstractWidget component, String message) {
4247
//#if MC>=11601
43-
//$$ component.setMessage(new net.minecraft.network.chat.TextComponent(message));
48+
//$$ component.setMessage(MCVer.literal(message));
4449
//#else
4550
//$$ component.setMessage(message);
4651
//#endif
@@ -93,13 +98,13 @@ public static String getCurrentWorldFolder() {
9398
//#endif
9499
//$$ }
95100
//$$ public static Checkbox Checkbox(int i, int j, int k, int l, String text, boolean bl) {
96-
//$$ return new Checkbox(i, j, k, l, new net.minecraft.network.chat.TextComponent(text), bl);
101+
//$$ return new Checkbox(i, j, k, l, MCVer.literal(text), bl);
97102
//$$ }
98103
//$$ public static Button Button(int i, int j, int k, int l, String text, OnPress onpress) {
99-
//$$ return new Button(i, j, k, l, new net.minecraft.network.chat.TextComponent(text), onpress);
104+
//$$ return new Button(i, j, k, l, MCVer.literal(text), onpress);
100105
//$$ }
101106
//$$ public static EditBox EditBox(Font f, int i, int j, int k, int l, String text) {
102-
//$$ return new EditBox(f, i, j, k, l, new net.minecraft.network.chat.TextComponent(text));
107+
//$$ return new EditBox(f, i, j, k, l, MCVer.literal(text));
103108
//$$ }
104109
//$$ public static void blit(int i, int j, float k, float f, int g, int l) {
105110
//$$ GuiComponent.blit(stack, i, j, k, f, g, l, 256, 256);
@@ -150,8 +155,8 @@ public static EditBox EditBox(Font f, int i, int j, int k, int l, String text) {
150155
public static void blit(int a, int b, int c, float d, float e, int f, int g, int h, int i) {
151156
GuiComponent.blit(a, b, c, d, e, f, g, h, i);
152157
}
153-
public static void fill(int a, int b, int c, int d, int e) {
154-
GuiComponent.fill(a, b, c, d, e);
158+
public static void fill(int x, int y, int x2, int y2, int color) {
159+
GuiComponent.fill(x, y, x2, y2, color);
155160
}
156161
public static void drawCenteredString(Screen s, String text, int x, int y, int color) {
157162
s.drawCenteredString(Minecraft.getInstance().font, text, x, y, color);
@@ -424,7 +429,7 @@ public static void scaled(Object poseStack, double scale, double scale2, double
424429
com.mojang.blaze3d.platform.GlStateManager.scaled(scale, scale2, scale3);
425430
}
426431

427-
public static void rotated(Object poseStack, int i, int j, int k, int l) {
432+
public static void rotated(Object poseStack, double i, double j, double k, double l) {
428433
com.mojang.blaze3d.platform.GlStateManager.rotated(i, j, k, l);
429434
}
430435

@@ -492,4 +497,12 @@ public static com.mojang.blaze3d.platform.Window getGLWindow() {
492497
return Minecraft.getInstance().window;
493498
//#endif
494499
}
500+
501+
public static Component literal(String s) {
502+
//#if MC>=11900
503+
//$$ return Component.literal(s);
504+
//#else
505+
return new net.minecraft.network.chat.TextComponent(s);
506+
//#endif
507+
}
495508
}
Lines changed: 140 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,115 +1,153 @@
11
package de.pfannekuchen.lotas.core.utils;
22

3-
import org.lwjgl.opengl.GL11;
4-
5-
import com.mojang.blaze3d.platform.Window;
6-
import com.mojang.blaze3d.platform.GlStateManager.DestFactor;
7-
import com.mojang.blaze3d.platform.GlStateManager.SourceFactor;
8-
93
import de.pfannekuchen.lotas.core.MCVer;
10-
import net.minecraft.client.Minecraft;
11-
import net.minecraft.nbt.CompoundTag;
12-
import net.minecraft.world.item.ItemStack;
13-
import net.minecraft.world.item.Items;
14-
import net.minecraft.world.item.PotionItem;
154

165
/**
17-
* Draws a potion in the gui hud that is moving with the camera
6+
* Draws a potion in the gui hud pixel by pixel
187
*
198
* @author ScribbleLP
209
* @since v1.0
21-
* @version v1.2
10+
* @version v1.3
2211
*/
2312
public class PotionRenderer {
24-
25-
public static float lerpX = 0f;
26-
public static float lerpY = 0f;
27-
28-
public static float lerp(float point1, float point2, float alpha) {
29-
return point1 + alpha * (point2 - point1);
13+
14+
public static void render(Object poseStack, double xPos, double yPos, double rotation) {
15+
double scale=1;
16+
xPos+=2.2;
17+
yPos+=-0.5;
18+
scale+=0.26;
19+
MCVer.translated(poseStack, xPos, yPos, 0);
20+
MCVer.scaled(poseStack, scale, scale, scale);
21+
22+
//#if MC>=11700
23+
//$$ MCVer.stack.mulPose(com.mojang.math.Quaternion.fromXYZ(0, 0, (float) rotation));
24+
//#else
25+
MCVer.rotated(poseStack, rotation, 0, 0, 1);
26+
//#endif
27+
28+
int orangeBright=0xE35720;
29+
int orange=0xC24218;
30+
int orangeDark=0x9A3212;
31+
32+
int white=0xFFFFFF;
33+
int cyan=0x546980;
34+
35+
int y=0;
36+
renderPixel(8, y, orangeBright);
37+
renderPixel(9, y, orangeBright);
38+
39+
y=1;
40+
renderPixel(7, y, orange);
41+
renderPixel(8, y, orange);
42+
renderPixel(9, y, orangeBright);
43+
44+
y=2;
45+
renderPixel(6, y, orange);
46+
renderPixel(7, y, orange);
47+
renderPixel(8, y, orange);
48+
renderPixel(9, y, orange);
49+
50+
y=3;
51+
renderPixel(5, y, white);
52+
renderPixel(8, y, orangeDark);
53+
renderPixel(9, y, orange);
54+
55+
y=4;
56+
renderPixel(4, y, white);
57+
renderPixel(7, y, white);
58+
renderPixel(8, y, orangeDark);
59+
renderPixel(9, y, orangeDark);
60+
61+
y=5;
62+
renderPixel(3, y, white);
63+
renderPixel(7, y, white);
64+
65+
y=6;
66+
renderPixel(2, y, white);
67+
renderPixel(3, y, cyan);
68+
renderPixel(4, y, white);
69+
renderPixel(5, y, cyan);
70+
renderPixel(6, y, cyan);
71+
renderPixel(7, y, cyan);
72+
renderPixel(8, y, white);
73+
74+
y=7;
75+
renderPixel(1, y, white);
76+
renderPixel(2, y, cyan);
77+
renderPixel(3, y, white);
78+
renderPixel(4, y, cyan);
79+
renderPixel(5, y, cyan);
80+
renderPixel(6, y, cyan);
81+
renderPixel(7, y, cyan);
82+
renderPixel(8, y, cyan);
83+
renderPixel(9, y, white);
84+
85+
y=8;
86+
renderPixel(1, y, white);
87+
renderPixel(2, y, cyan);
88+
renderPixel(3, y, white);
89+
renderPixel(4, y, cyan);
90+
renderPixel(5, y, cyan);
91+
renderPixel(6, y, cyan);
92+
renderPixel(7, y, cyan);
93+
renderPixel(8, y, cyan);
94+
renderPixel(9, y, white);
95+
96+
y=9;
97+
renderPixel(1, y, white);
98+
renderPixel(2, y, cyan);
99+
renderPixel(3, y, cyan);
100+
renderPixel(4, y, cyan);
101+
renderPixel(5, y, cyan);
102+
renderPixel(6, y, cyan);
103+
renderPixel(7, y, white);
104+
renderPixel(8, y, cyan);
105+
renderPixel(9, y, white);
106+
107+
y=10;
108+
renderPixel(1, y, white);
109+
renderPixel(2, y, cyan);
110+
renderPixel(3, y, cyan);
111+
renderPixel(4, y, cyan);
112+
renderPixel(5, y, cyan);
113+
renderPixel(6, y, cyan);
114+
renderPixel(7, y, white);
115+
renderPixel(8, y, cyan);
116+
renderPixel(9, y, white);
117+
118+
y=11;
119+
renderPixel(1, y, white);
120+
renderPixel(2, y, white);
121+
renderPixel(3, y, cyan);
122+
renderPixel(4, y, cyan);
123+
renderPixel(5, y, cyan);
124+
renderPixel(6, y, white);
125+
renderPixel(7, y, cyan);
126+
renderPixel(8, y, white);
127+
renderPixel(9, y, white);
128+
129+
y=12;
130+
renderPixel(3, y, white);
131+
renderPixel(4, y, white);
132+
renderPixel(5, y, white);
133+
renderPixel(6, y, white);
134+
renderPixel(7, y, white);
135+
136+
//#if MC>=11700
137+
//$$ MCVer.stack.mulPose(com.mojang.math.Quaternion.fromXYZ(0, 0, (float) -rotation));
138+
//#else
139+
MCVer.rotated(poseStack, -rotation, 0, 0, 1);
140+
//#endif
141+
MCVer.scaled(poseStack, (double)1/scale, (double)1/scale, (double)1/scale);
142+
MCVer.translated(poseStack, -xPos, -yPos, 0);
143+
144+
//#if MC<11600
145+
MCVer.color4f(255, 255, 255, 255);
146+
//#endif
30147
}
31-
32-
//#if MC>=11500
33-
//$$ public static ItemStack render(com.mojang.blaze3d.vertex.PoseStack matrices) {
34-
//$$ ItemStack stack = new ItemStack(Items.POTION);
35-
//$$ if (stack.getItem() instanceof PotionItem) {
36-
//$$ CompoundTag cp = new CompoundTag();
37-
//$$ cp.putInt("CustomPotionColor", 0x4672A3);
38-
//$$ stack.setTag(cp);
39-
//$$ }
40-
//$$
41-
//$$ Window window = MCVer.getGLWindow();
42-
//$$
43-
//$$ float scale = (float) (window.getGuiScale() / 3);
44-
//$$ int height = window.getHeight();
45-
//$$
46-
//$$ matrices.translate(0, 0, -13);
47-
//$$
48-
//$$ double skla = 4.1;
49-
//$$ if (scale == 1D) {
50-
//$$ skla = 4.85;
51-
//$$ } else if (scale < 1 && scale > 0.4) {
52-
//$$ skla = 5.6;
53-
//$$ } else if (scale < 0.4 && scale > 0.1) {
54-
//$$ skla = 6.6;
55-
//$$ }
56-
//$$ double height2 = (height / 2 * -0.004) - skla;
57-
//$$
58-
//$$ matrices.translate(0, height2, 0);
59-
//$$ matrices.scale(scale, scale, scale);
60-
//$$
61-
//$$ float scale2 = (float) (1 + (1080 - height) * 0.0015);
62-
//$$ matrices.scale(scale2, scale2, scale2);
63-
//$$
64-
//$$ if (Minecraft.getInstance().player.isUnderWater()) {
65-
//$$ matrices.translate(0, 0, -2.5);
66-
//$$ }
67-
//$$ matrices.mulPose(com.mojang.math.Vector3f.YP.rotationDegrees(180));
68-
//$$ matrices.mulPose(com.mojang.math.Vector3f.ZP.rotationDegrees(10));
69-
//$$ return stack;
70-
//$$ }
71-
//#else
72-
public static ItemStack render() {
73-
ItemStack stack = new ItemStack(Items.POTION);
74-
if (stack.getItem() instanceof PotionItem) {
75-
CompoundTag cp = new CompoundTag();
76-
cp.putInt("CustomPotionColor", 0x4672A3);
77-
stack.setTag(cp);
78-
}
79-
80-
Window window= Minecraft.getInstance().window;
81-
82-
double scale=window.getGuiScale()/3;
83-
int height=window.getScreenHeight();
84-
85-
MCVer.translated(null, 0, 0.0f, -13);
86-
87-
double skla=4.1;
88-
if(scale==1D) {
89-
skla=4.85;
90-
}
91-
else if(scale<1&&scale>0.4) {
92-
skla=5.6;
93-
}
94-
else if(scale<0.4&&scale>0.1) {
95-
skla=6.6;
96-
}
97-
double height2=(height/2*-0.004)-skla;
98-
99-
100-
MCVer.translated(null, 0, height2, 0);
101-
MCVer.scaled(null, scale, scale, scale);
102-
103-
double scale2=1+(1080-height)*0.0015;
104-
MCVer.scaled(null, scale2, scale2, scale2);
105-
106-
if(Minecraft.getInstance().player.isUnderWater()) {
107-
MCVer.translated(null, 0, 0, -2.5);
108-
}
109-
MCVer.rotated(null, 180, 0, 1, 0);
110-
MCVer.rotated(null, 10, 0, 0, 1);
111-
return stack;
148+
149+
private static void renderPixel(int x, int y, int color) {
150+
int alpha=0x80000000;
151+
MCVer.fill(x, y, x+1,y+1, alpha+color);
112152
}
113-
//#endif
114-
115153
}

LoTAS-Fabric/src/main/java/de/pfannekuchen/lotas/core/utils/RenderUtils.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,9 +59,9 @@ public static void applyRegionalRenderOffset(Object poseStack, ChunkAccess chunk
5959
}
6060

6161
public static void applyCameraRotationOnly(Object poseStack) {
62-
Camera camera = MCVer.getBlockEntityDispatcher().camera;
6362
//#if MC>=11500
6463
//#if MC<=11605
64+
//$$ Camera camera = MCVer.getBlockEntityDispatcher().camera;
6565
//$$ MCVer.rotated(poseStack, Mth.wrapDegrees(camera.getXRot()), 1, 0, 0);
6666
//$$ MCVer.rotated(poseStack, Mth.wrapDegrees(camera.getYRot() + 180.0), 0, 1, 0);
6767
//#endif
@@ -117,9 +117,12 @@ public static void drawSolidBox(Object poseStack, AABB bb, float r, float g, flo
117117
//$$ bufferBuilder.vertex(matrix, (float)bb.maxX, (float)bb.minY, (float)bb.minZ).color(r, g, b, a).endVertex();
118118
//$$ bufferBuilder.vertex(matrix, (float)bb.minX, (float)bb.minY, (float)bb.minZ).color(r, g, b, a).endVertex();
119119
//$$
120+
//#if MC>=11900
121+
//$$ BufferUploader.drawWithShader(bufferBuilder.end());
122+
//#else
120123
//$$ bufferBuilder.end();
121-
//$$
122124
//$$ BufferUploader.end(bufferBuilder);
125+
//#endif
123126
//#else
124127
bufferBuilder.begin(GL11.GL_QUADS, DefaultVertexFormat.POSITION_COLOR);
125128

@@ -205,9 +208,12 @@ public static void drawOutlinedBox(Object poseStack, AABB bb) {
205208
//$$ bufferBuilder.vertex(matrix, (float)bb.minX, (float)bb.maxY, (float)bb.maxZ).color(1F, 1F, 1F, 1F).endVertex();
206209
//$$ bufferBuilder.vertex(matrix, (float)bb.minX, (float)bb.maxY, (float)bb.minZ).color(1F, 1F, 1F, 1F).endVertex();
207210
//$$
211+
//#if MC>=11900
212+
//$$ BufferUploader.drawWithShader(bufferBuilder.end());
213+
//#else
208214
//$$ bufferBuilder.end();
209-
//$$
210215
//$$ BufferUploader.end(bufferBuilder);
216+
//#endif
211217
//#else
212218
bufferBuilder.begin(GL11.GL_LINES, DefaultVertexFormat.POSITION_COLOR);
213219
bufferBuilder.vertex(bb.minX, bb.minY, bb.minZ).color(1F, 1F, 1F, 1F).endVertex();
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package de.pfannekuchen.lotas.core.utils.quack;
2+
3+
public interface SoundPitchDuck {
4+
public void updatePitch();
5+
}

0 commit comments

Comments
 (0)