Added build mode categories with colored lines. Hiding pyramid/cone/dome buttons for now. Changed icon of normal mode and renamed to disable.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package nl.requios.effortlessbuilding.buildmode;
|
||||
|
||||
import com.mojang.math.Vector4f;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.BlockPos;
|
||||
@@ -247,29 +248,31 @@ public class BuildModes {
|
||||
}
|
||||
|
||||
public enum BuildModeEnum {
|
||||
NORMAL("normal", new Normal()),
|
||||
NORMAL_PLUS("normal_plus", new NormalPlus(), OptionEnum.BUILD_SPEED),
|
||||
LINE("line", new Line() /*, OptionEnum.THICKNESS*/),
|
||||
WALL("wall", new Wall(), OptionEnum.FILL),
|
||||
FLOOR("floor", new Floor(), OptionEnum.FILL),
|
||||
DIAGONAL_LINE("diagonal_line", new DiagonalLine() /*, OptionEnum.THICKNESS*/),
|
||||
DIAGONAL_WALL("diagonal_wall", new DiagonalWall() /*, OptionEnum.FILL*/),
|
||||
SLOPE_FLOOR("slope_floor", new SlopeFloor(), OptionEnum.RAISED_EDGE),
|
||||
CIRCLE("circle", new Circle(), OptionEnum.CIRCLE_START, OptionEnum.FILL),
|
||||
CYLINDER("cylinder", new Cylinder(), OptionEnum.CIRCLE_START, OptionEnum.FILL),
|
||||
SPHERE("sphere", new Sphere(), OptionEnum.CIRCLE_START, OptionEnum.FILL),
|
||||
CUBE("cube", new Cube(), OptionEnum.CUBE_FILL),
|
||||
PYRAMID("pyramid", new Pyramid()),
|
||||
CONE("cone", new Cone()),
|
||||
DOME("dome", new Dome());
|
||||
NORMAL("normal", new Normal(), BuildModeCategoryEnum.BASIC),
|
||||
NORMAL_PLUS("normal_plus", new NormalPlus(), BuildModeCategoryEnum.BASIC, OptionEnum.BUILD_SPEED),
|
||||
LINE("line", new Line(), BuildModeCategoryEnum.BASIC /*, OptionEnum.THICKNESS*/),
|
||||
WALL("wall", new Wall(), BuildModeCategoryEnum.BASIC, OptionEnum.FILL),
|
||||
FLOOR("floor", new Floor(), BuildModeCategoryEnum.BASIC, OptionEnum.FILL),
|
||||
CUBE("cube", new Cube(), BuildModeCategoryEnum.BASIC, OptionEnum.CUBE_FILL),
|
||||
DIAGONAL_LINE("diagonal_line", new DiagonalLine(), BuildModeCategoryEnum.DIAGONAL /*, OptionEnum.THICKNESS*/),
|
||||
DIAGONAL_WALL("diagonal_wall", new DiagonalWall(), BuildModeCategoryEnum.DIAGONAL /*, OptionEnum.FILL*/),
|
||||
SLOPE_FLOOR("slope_floor", new SlopeFloor(), BuildModeCategoryEnum.DIAGONAL, OptionEnum.RAISED_EDGE),
|
||||
CIRCLE("circle", new Circle(), BuildModeCategoryEnum.CIRCULAR, OptionEnum.CIRCLE_START, OptionEnum.FILL),
|
||||
CYLINDER("cylinder", new Cylinder(), BuildModeCategoryEnum.CIRCULAR, OptionEnum.CIRCLE_START, OptionEnum.FILL),
|
||||
SPHERE("sphere", new Sphere(), BuildModeCategoryEnum.CIRCULAR, OptionEnum.CIRCLE_START, OptionEnum.FILL);
|
||||
// PYRAMID("pyramid", new Pyramid(), BuildModeCategoryEnum.ROOF),
|
||||
// CONE("cone", new Cone(), BuildModeCategoryEnum.ROOF),
|
||||
// DOME("dome", new Dome(), BuildModeCategoryEnum.ROOF);
|
||||
|
||||
private String name;
|
||||
public IBuildMode instance;
|
||||
public OptionEnum[] options;
|
||||
private final String name;
|
||||
public final IBuildMode instance;
|
||||
public final BuildModeCategoryEnum category;
|
||||
public final OptionEnum[] options;
|
||||
|
||||
BuildModeEnum(String name, IBuildMode instance, OptionEnum... options) {
|
||||
BuildModeEnum(String name, IBuildMode instance, BuildModeCategoryEnum category, OptionEnum... options) {
|
||||
this.name = name;
|
||||
this.instance = instance;
|
||||
this.category = category;
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@@ -281,4 +284,17 @@ public class BuildModes {
|
||||
return "effortlessbuilding.modedescription." + name;
|
||||
}
|
||||
}
|
||||
|
||||
public enum BuildModeCategoryEnum {
|
||||
BASIC(new Vector4f(0f, .5f, 1f, .8f)),
|
||||
DIAGONAL(new Vector4f(0.56f, 0.28f, 0.87f, .8f)),
|
||||
CIRCULAR(new Vector4f(0.29f, 0.76f, 0.3f, 1f)),
|
||||
ROOF(new Vector4f(0.83f, 0.87f, 0.23f, .8f));
|
||||
|
||||
public final Vector4f color;
|
||||
|
||||
BuildModeCategoryEnum(Vector4f color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,7 @@ public class RadialMenu extends Screen {
|
||||
|
||||
private final double ringInnerEdge = 40;
|
||||
private final double ringOuterEdge = 80;
|
||||
private final double categoryLineOuterEdge = 42;
|
||||
private final double textDistance = 90;
|
||||
private final double buttonDistance = 120;
|
||||
private final float fadeSpeed = 0.3f;
|
||||
@@ -182,15 +183,14 @@ public class RadialMenu extends Screen {
|
||||
private void drawRadialButtonBackgrounds(BuildModeEnum currentBuildMode, BufferBuilder buffer, double middleX, double middleY, double mouseXCenter, double mouseYCenter, double mouseRadians, double ringInnerEdge, double ringOuterEdge, double quarterCircle, ArrayList<MenuRegion> modes) {
|
||||
if (!modes.isEmpty()) {
|
||||
final int totalModes = Math.max(3, modes.size());
|
||||
int currentMode = 0;
|
||||
final double fragment = Math.PI * 0.005;
|
||||
final double fragment2 = Math.PI * 0.0025;
|
||||
final double perObject = 2.0 * Math.PI / totalModes;
|
||||
final double fragment = Math.PI * 0.005; //gap between buttons in radians at inner edge
|
||||
final double fragment2 = Math.PI * 0.0025; //gap between buttons in radians at outer edge
|
||||
final double radiansPerObject = 2.0 * Math.PI / totalModes;
|
||||
|
||||
for (int i = 0; i < modes.size(); i++) {
|
||||
MenuRegion menuRegion = modes.get(i);
|
||||
final double beginRadians = currentMode * perObject - quarterCircle;
|
||||
final double endRadians = (currentMode + 1) * perObject - quarterCircle;
|
||||
final double beginRadians = i * radiansPerObject - quarterCircle;
|
||||
final double endRadians = (i + 1) * radiansPerObject - quarterCircle;
|
||||
|
||||
menuRegion.x1 = Math.cos(beginRadians);
|
||||
menuRegion.x2 = Math.cos(endRadians);
|
||||
@@ -227,7 +227,18 @@ public class RadialMenu extends Screen {
|
||||
buffer.vertex(middleX + x2m2, middleY + y2m2, getBlitOffset()).color(color.x(), color.y(), color.z(), color.w()).endVertex();
|
||||
buffer.vertex(middleX + x1m2, middleY + y1m2, getBlitOffset()).color(color.x(), color.y(), color.z(), color.w()).endVertex();
|
||||
|
||||
currentMode++;
|
||||
//Category line
|
||||
color = menuRegion.mode.category.color;
|
||||
|
||||
final double x1m3 = Math.cos(beginRadians + fragment) * categoryLineOuterEdge;
|
||||
final double x2m3 = Math.cos(endRadians - fragment) * categoryLineOuterEdge;
|
||||
final double y1m3 = Math.sin(beginRadians + fragment) * categoryLineOuterEdge;
|
||||
final double y2m3 = Math.sin(endRadians - fragment) * categoryLineOuterEdge;
|
||||
|
||||
buffer.vertex(middleX + x1m1, middleY + y1m1, getBlitOffset()).color(color.x(), color.y(), color.z(), color.w()).endVertex();
|
||||
buffer.vertex(middleX + x2m1, middleY + y2m1, getBlitOffset()).color(color.x(), color.y(), color.z(), color.w()).endVertex();
|
||||
buffer.vertex(middleX + x2m3, middleY + y2m3, getBlitOffset()).color(color.x(), color.y(), color.z(), color.w()).endVertex();
|
||||
buffer.vertex(middleX + x1m3, middleY + y1m3, getBlitOffset()).color(color.x(), color.y(), color.z(), color.w()).endVertex();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
"effortlessbuilding:reach_upgrade2": "Reach Upgrade 2",
|
||||
"effortlessbuilding:reach_upgrade3": "Reach Upgrade 3",
|
||||
|
||||
"effortlessbuilding.mode.normal": "Normal",
|
||||
"effortlessbuilding.mode.normal_plus": "Normal+",
|
||||
"effortlessbuilding.mode.normal": "Disable",
|
||||
"effortlessbuilding.mode.normal_plus": "Single",
|
||||
"effortlessbuilding.mode.line": "Line",
|
||||
"effortlessbuilding.mode.wall": "Wall",
|
||||
"effortlessbuilding.mode.floor": "Floor",
|
||||
@@ -35,7 +35,7 @@
|
||||
"effortlessbuilding.mode.dome": "Dome",
|
||||
|
||||
"effortlessbuilding.modedescription.normal": "Disable mod and use vanilla placement rules",
|
||||
"effortlessbuilding.modedescription.normal_plus": "Single block, but with increased reach and placement preview",
|
||||
"effortlessbuilding.modedescription.normal_plus": "Like vanilla, but with increased reach and placement preview",
|
||||
"effortlessbuilding.modedescription.line": "",
|
||||
"effortlessbuilding.modedescription.wall": "",
|
||||
"effortlessbuilding.modedescription.floor": "",
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 317 B After Width: | Height: | Size: 333 B |
Binary file not shown.
|
Before Width: | Height: | Size: 355 B After Width: | Height: | Size: 317 B |
Reference in New Issue
Block a user