Upload files to "src/openonyx/features/render"
This commit is contained in:
1 parent
e771e05f20
commit
237fe3da04
5 files changed
+255
No files matched your search
@@ -0,0 +1,15 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import openonyx.history.SettingGroup;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
public final class BlockOverlayPart extends SettingGroup {
|
||||||
|
public final NumberSetting glintSpeed = new NumberSetting("Glint speed", 1.0, 0.1, 4.0, 0.1);
|
||||||
|
public final NumberSetting glintGlow;
|
||||||
|
public final NumberSetting glintScale = new NumberSetting("Glint scale", 1.5, 0.5, 4.0, 0.1).describe("How large the curtains are across the block face");
|
||||||
|
|
||||||
|
public BlockOverlayPart() {
|
||||||
|
super("Glint");
|
||||||
|
this.glintGlow = new NumberSetting("Glint glow", 60.0, 0.0, 100.0, 5.0).withSuffix("%");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import openonyx.history.SettingGroup;
|
||||||
|
import openonyx.history.internal.EnumSetting;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
public final class BlockOverlayPart2 extends SettingGroup {
|
||||||
|
public final EnumSetting<AppearanceMode> appearance;
|
||||||
|
public final NumberSetting fade;
|
||||||
|
public final NumberSetting appear = new NumberSetting("Appear", 140.0, 0.0, 600.0, 10.0).withSuffix(" ms");
|
||||||
|
public final NumberSetting move = new NumberSetting("Move", 110.0, 0.0, 600.0, 10.0)
|
||||||
|
.withSuffix(" ms")
|
||||||
|
.describe("How long the box takes to slide to a neighbouring block");
|
||||||
|
|
||||||
|
public BlockOverlayPart2() {
|
||||||
|
super("Animation");
|
||||||
|
this.fade = new NumberSetting("Fade", 180.0, 0.0, 600.0, 10.0).withSuffix(" ms");
|
||||||
|
this.appearance = new EnumSetting<>("Appearance", AppearanceMode.POP).describe("Fade alone, a small pop, or growing out of the centre of the block");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import openonyx.history.SettingSection;
|
||||||
|
import openonyx.history.internal.EnumSetting;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
|
||||||
|
public final class BlockOverlayPart3 extends SettingSection {
|
||||||
|
public final NumberSetting progressOpacity;
|
||||||
|
public final EnumSetting<DirectionMode> direction;
|
||||||
|
public final EnumSetting<FeatureSupport_327Mode> mode = new EnumSetting<>("Mode", FeatureSupport_327Mode.FILL)
|
||||||
|
.describe("The fill rising across the block, or growing out of its centre");
|
||||||
|
|
||||||
|
public BlockOverlayPart3() {
|
||||||
|
super("Break progress", true);
|
||||||
|
this.direction = new EnumSetting<>("Direction", DirectionMode.DOWN).describe("Which way the fill travels as the block breaks");
|
||||||
|
this.progressOpacity = new NumberSetting("Progress opacity", 45.0, 1.0, 100.0, 1.0).withSuffix("%").describe("How solid the broken part of the block is");
|
||||||
|
this.direction.visibleWhen(() -> this.mode.is(FeatureSupport_327Mode.FILL));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,195 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
|
import java.util.Iterator;
|
||||||
|
import java.util.List;
|
||||||
|
import net.minecraft.client.gui.ScaledResolution;
|
||||||
|
import net.minecraft.entity.Entity;
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import openonyx.events.TargetType;
|
||||||
|
import openonyx.features.Module;
|
||||||
|
import openonyx.features.ModuleCategory;
|
||||||
|
import openonyx.history.internal.BooleanSetting;
|
||||||
|
import openonyx.history.internal.EnumSetting;
|
||||||
|
import openonyx.history.internal.NumberSetting;
|
||||||
|
import openonyx.render.BoxRenderer;
|
||||||
|
import openonyx.render.EntityProjection;
|
||||||
|
import openonyx.render.EntityProjectionData2;
|
||||||
|
import openonyx.render.Render2D;
|
||||||
|
import openonyx.render.WorldToScreen;
|
||||||
|
import openonyx.theme.internal.ColorUtils;
|
||||||
|
|
||||||
|
public final class Boxes extends Module {
|
||||||
|
public final EnumSetting<Shape> shape = new EnumSetting<>("Shape", Shape.TWO_D)
|
||||||
|
.describe("A flat rectangle around the entity, or a cuboid sitting on it in the world");
|
||||||
|
public final NumberSetting distance;
|
||||||
|
private static final double m = 0.125;
|
||||||
|
private static final double h = 0.06;
|
||||||
|
public final BooleanSetting throughWalls;
|
||||||
|
public final BoxesPart boxesPart;
|
||||||
|
public final EnumSetting<Style> style = new EnumSetting<>("Style", Style.OUTLINE).describe("Lines only, or lines over a translucent fill");
|
||||||
|
private static final float i = 2.0F;
|
||||||
|
private final Render2D render2D;
|
||||||
|
public final NumberSetting fillOpacity = new NumberSetting("Fill opacity", 18.0, 1.0, 60.0, 1.0)
|
||||||
|
.withSuffix("%")
|
||||||
|
.describe("How solid the fill sits behind the outline")
|
||||||
|
.visibleWhen(() -> this.style.is(Style.FILLED));
|
||||||
|
public final NumberSetting lineWidth = new NumberSetting("Line width", 1.5, 0.5, 5.0, 0.5).withSuffix(" px");
|
||||||
|
|
||||||
|
private static AxisAlignedBB L(AxisAlignedBB axisAlignedBB) {
|
||||||
|
double d = axisAlignedBB.maxY - axisAlignedBB.minY;
|
||||||
|
d = Math.min(0.125, d * 0.5);
|
||||||
|
return new AxisAlignedBB(axisAlignedBB.minX, axisAlignedBB.minY, axisAlignedBB.minZ, axisAlignedBB.maxX, axisAlignedBB.maxY - d, axisAlignedBB.maxZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static AxisAlignedBB L(EntityLivingBase entityLivingBase, float f) {
|
||||||
|
double d = entityLivingBase.lastTickPosX + (entityLivingBase.posX - entityLivingBase.lastTickPosX) * f - entityLivingBase.posX;
|
||||||
|
double e = entityLivingBase.lastTickPosY + (entityLivingBase.posY - entityLivingBase.lastTickPosY) * f - entityLivingBase.posY;
|
||||||
|
double g = entityLivingBase.lastTickPosZ + (entityLivingBase.posZ - entityLivingBase.lastTickPosZ) * f - entityLivingBase.posZ;
|
||||||
|
AxisAlignedBB axisAlignedBB = entityLivingBase.getEntityBoundingBox().offset(d, e, g).expand(0.06, 0.06, 0.06);
|
||||||
|
return L(entityLivingBase) ? L(axisAlignedBB) : axisAlignedBB;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boxes() {
|
||||||
|
super("Boxes", "Outlines entities with a 2D or 3D box", ModuleCategory.RENDER);
|
||||||
|
this.throughWalls = new BooleanSetting("Through walls", true)
|
||||||
|
.describe("Keeps the box visible when the entity is behind blocks")
|
||||||
|
.visibleWhen(() -> this.shape.is(Shape.THREE_D));
|
||||||
|
this.distance = new NumberSetting("Distance", 256.0, 8.0, 256.0, 8.0).withSuffix(" m").describe("Maximum distance at which a box is drawn");
|
||||||
|
this.boxesPart = new BoxesPart();
|
||||||
|
this.render2D = new Render2D().withoutCursor();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean L(EntityLivingBase entityLivingBase) {
|
||||||
|
return entityLivingBase instanceof EntityPlayer && ((EntityPlayer)entityLivingBase).isSneaking();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void d(float f) {
|
||||||
|
Boxes boxes1 = this;
|
||||||
|
if (boxes1.L(Shape.TWO_D) && WorldToScreen.L()) {
|
||||||
|
List list;
|
||||||
|
if (!(list = boxes1.D()).isEmpty()) {
|
||||||
|
ScaledResolution scaledResolution = new ScaledResolution(mc);
|
||||||
|
float j = scaledResolution.getScaledWidth();
|
||||||
|
float hx = scaledResolution.getScaledHeight();
|
||||||
|
boxes1.render2D.beginFrame();
|
||||||
|
Iterator iterator = list.iterator();
|
||||||
|
|
||||||
|
label31:
|
||||||
|
while (true) {
|
||||||
|
Iterator iterator1 = iterator;
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
BoxesData boxesData;
|
||||||
|
EntityProjectionData2 entityProjectionData2;
|
||||||
|
if ((entityProjectionData2 = EntityProjection.L((boxesData = (BoxesData)iterator.next()).entity(), f, j, hx)) == null) {
|
||||||
|
continue label31;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entityProjectionData2.width() < 2.0F) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
int ix = boxesData.color();
|
||||||
|
float g = boxes1.lineWidth.getFloat();
|
||||||
|
if (boxes1.style.is(Style.FILLED)) {
|
||||||
|
boxes1.render2D
|
||||||
|
.rect(
|
||||||
|
entityProjectionData2.left(),
|
||||||
|
entityProjectionData2.top(),
|
||||||
|
entityProjectionData2.width(),
|
||||||
|
entityProjectionData2.height(),
|
||||||
|
boxes1.L(ix)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
boxes1.render2D
|
||||||
|
.roundedOutline(
|
||||||
|
entityProjectionData2.left(),
|
||||||
|
entityProjectionData2.top(),
|
||||||
|
entityProjectionData2.width(),
|
||||||
|
entityProjectionData2.height(),
|
||||||
|
0.0F,
|
||||||
|
g,
|
||||||
|
ix
|
||||||
|
);
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
boxes1.render2D.clearScissors();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void L(float f) {
|
||||||
|
Boxes boxes1 = this;
|
||||||
|
if (boxes1.L(Shape.THREE_D)) {
|
||||||
|
List list;
|
||||||
|
if (!(list = boxes1.D()).isEmpty()) {
|
||||||
|
if (BoxRenderer.L(f, boxes1.throughWalls.isEnabled())) {
|
||||||
|
Iterator iterator;
|
||||||
|
Iterator iterator1 = iterator = list.iterator();
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
BoxesData boxesData = (BoxesData)iterator.next();
|
||||||
|
iterator1 = iterator;
|
||||||
|
int ix = boxesData.color();
|
||||||
|
BoxRenderer.L(L(boxesData.entity(), f), ix, boxes1.lineWidth.getFloat(), boxes1.L(ix));
|
||||||
|
}
|
||||||
|
|
||||||
|
BoxRenderer.L();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean L(Shape shape) {
|
||||||
|
return this.isEnabled() && this.shape.is(shapex) && mc.thePlayer != null && mc.theWorld != null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int L(int i) {
|
||||||
|
return this.style.is(Style.FILLED) ? ColorUtils.withAlpha(ix, this.fillOpacity.getFloat() / 100.0F) : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<BoxesData> D() {
|
||||||
|
Boxes boxes1 = this;
|
||||||
|
ArrayList arrayList = new ArrayList();
|
||||||
|
double d = boxes1.distance.getValue() * boxes1.distance.getValue();
|
||||||
|
Iterator iterator = mc.theWorld.loadedEntityList.iterator();
|
||||||
|
|
||||||
|
label26:
|
||||||
|
while (true) {
|
||||||
|
Iterator iterator1 = iterator;
|
||||||
|
|
||||||
|
while (iterator1.hasNext()) {
|
||||||
|
Entity entity;
|
||||||
|
if (!((entity = (Entity)iterator.next()) instanceof EntityLivingBase)) {
|
||||||
|
continue label26;
|
||||||
|
}
|
||||||
|
|
||||||
|
TargetType targetType;
|
||||||
|
if ((targetType = TargetType.L(entity = entity)) == null) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
BoxesPart2 boxesPart2;
|
||||||
|
if (!(boxesPart2 = boxes1.boxesPart.L(targetType)).isEnabled()) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else if (mc.thePlayer.getDistanceSqToEntity(entity) > d) {
|
||||||
|
iterator1 = iterator;
|
||||||
|
} else {
|
||||||
|
arrayList.add(new BoxesData(entity, boxesPart2.color.getOpaque()));
|
||||||
|
iterator1 = iterator;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
arrayList.sort(Comparator.<BoxesData>comparingDouble(boxesData -> mc.thePlayer.getDistanceSqToEntity(boxesData.entity())).reversed());
|
||||||
|
return arrayList;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package openonyx.features.render;
|
||||||
|
|
||||||
|
import net.minecraft.entity.EntityLivingBase;
|
||||||
|
|
||||||
|
record BoxesData(EntityLivingBase entity, int color) {
|
||||||
|
}
|
||||||
Reference in new issue
Block a user