fix mod menu background transparency
This commit is contained in:
parent
6acc2de314
commit
cafd3700aa
2 changed files with 13 additions and 10 deletions
|
@ -18,7 +18,6 @@ public class PModMenuScreen extends Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
|
||||||
System.out.println("MENU ACTIVATED");
|
|
||||||
this.client.textRenderer.drawWithShadow(matrices, new LiteralText("Menu Open"), 10, 50, -1);
|
this.client.textRenderer.drawWithShadow(matrices, new LiteralText("Menu Open"), 10, 50, -1);
|
||||||
this.renderBackground(matrices);
|
this.renderBackground(matrices);
|
||||||
super.render(matrices, mouseX, mouseY, delta);
|
super.render(matrices, mouseX, mouseY, delta);
|
||||||
|
@ -26,7 +25,7 @@ public class PModMenuScreen extends Screen {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void init() {
|
protected void init() {
|
||||||
this.addButton(new PMovableButton(10, 10, 40, 10, PetroleumMod.getActiveMods().get(0)));
|
this.addButton(new PMovableButton(10, 10, PetroleumMod.getActiveMods().get(0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -39,12 +38,13 @@ public class PModMenuScreen extends Screen {
|
||||||
public void renderBackground(MatrixStack matrices) {
|
public void renderBackground(MatrixStack matrices) {
|
||||||
Tessellator t_1 = Tessellator.getInstance();
|
Tessellator t_1 = Tessellator.getInstance();
|
||||||
BufferBuilder buffer = t_1.getBuffer();
|
BufferBuilder buffer = t_1.getBuffer();
|
||||||
RenderSystem.color4f(0.0F, 0.0F, 0.0F, 0.1F);
|
RenderSystem.enableBlend();
|
||||||
buffer.begin(7, VertexFormats.POSITION_COLOR);
|
buffer.begin(7, VertexFormats.POSITION_COLOR);
|
||||||
buffer.vertex(0,this.height, 0.0D).color(0.0F, 0.0F, 0.0F, 0.1F).next();
|
buffer.vertex(0,this.height, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next();
|
||||||
buffer.vertex(this.width, this.height, 0.0D).color(0.0F, 0.0F, 0.0F, 0.1F).next();
|
buffer.vertex(this.width, this.height, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next();
|
||||||
buffer.vertex(this.width, 0, 0.0D).color(0.0F, 0.0F, 0.0F, 0.1F).next();
|
buffer.vertex(this.width, 0, 0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next();
|
||||||
buffer.vertex(0,0,0.0D).color(0.0F, 0.0F, 0.0F, 0.1F).next();
|
buffer.vertex(0,0,0.0D).color(0.1F, 0.1F, 0.1F, 0.3F).next();
|
||||||
t_1.draw();
|
t_1.draw();
|
||||||
|
RenderSystem.disableBlend();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,13 +10,16 @@ import net.minecraft.util.math.MathHelper;
|
||||||
import pm.j4.petroleum.modules.base.ModuleBase;
|
import pm.j4.petroleum.modules.base.ModuleBase;
|
||||||
|
|
||||||
public class PMovableButton extends AbstractButtonWidget {
|
public class PMovableButton extends AbstractButtonWidget {
|
||||||
public PMovableButton(int x, int y, int width, int height, ModuleBase module) {
|
public PMovableButton(int x, int y, ModuleBase module) {
|
||||||
super(x, y, width, height, module.getReadableName());
|
super(x, y, 0, 0, module.getReadableName());
|
||||||
|
int w = MinecraftClient.getInstance().textRenderer.getWidth(module.getReadableName()) + 8;
|
||||||
|
int h = MinecraftClient.getInstance().textRenderer.fontHeight + 8;
|
||||||
|
this.width = w;
|
||||||
|
this.height = h;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) {
|
protected void onDrag(double mouseX, double mouseY, double deltaX, double deltaY) {
|
||||||
System.out.println(mouseX + "/" + mouseY + "/" + deltaX + "/" + deltaY);
|
|
||||||
this.x += (int)deltaX;
|
this.x += (int)deltaX;
|
||||||
this.y += (int)deltaY;
|
this.y += (int)deltaY;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue