diff options
author | syeyoung <cyong06@naver.com> | 2021-01-08 10:58:13 +0900 |
---|---|---|
committer | syeyoung <cyong06@naver.com> | 2021-01-08 10:58:13 +0900 |
commit | a85cde380c6aa6447f8abfb105d2cc55cf7dc149 (patch) | |
tree | c113c8ed31a6504ba44d20001713e862f28c7a46 /src/main/java/kr/syeyoung | |
parent | 25bfa1d08f9618a83a3fcee27f71ac924b5d8754 (diff) | |
download | Skyblock-Dungeons-Guide-a85cde380c6aa6447f8abfb105d2cc55cf7dc149.tar.gz Skyblock-Dungeons-Guide-a85cde380c6aa6447f8abfb105d2cc55cf7dc149.tar.bz2 Skyblock-Dungeons-Guide-a85cde380c6aa6447f8abfb105d2cc55cf7dc149.zip |
colours!
Diffstat (limited to 'src/main/java/kr/syeyoung')
8 files changed, 400 insertions, 3 deletions
diff --git a/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandReparty.java b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandReparty.java new file mode 100644 index 00000000..92d5546a --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/commands/CommandReparty.java @@ -0,0 +1,52 @@ +package kr.syeyoung.dungeonsguide.commands; + +import kr.syeyoung.dungeonsguide.config.guiconfig.GuiConfig; +import kr.syeyoung.dungeonsguide.dungeon.roomfinder.DungeonRoomInfoRegistry; +import kr.syeyoung.dungeonsguide.e; +import net.minecraft.client.Minecraft; +import net.minecraft.command.CommandBase; +import net.minecraft.command.ICommandSender; +import net.minecraft.util.ChatComponentText; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.fml.common.gameevent.TickEvent; + +import javax.crypto.BadPaddingException; +import javax.crypto.IllegalBlockSizeException; +import javax.crypto.NoSuchPaddingException; +import java.io.IOException; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; +import java.security.NoSuchAlgorithmException; + +public class CommandReparty extends CommandBase { + @Override + public String getCommandName() { + return "reparty"; + } + + @Override + public String getCommandUsage(ICommandSender sender) { + return "reparty"; + } + + @Override + public void processCommand(ICommandSender sender, String[] args) { + + } + + @SubscribeEvent + public void onChat(ClientChatReceivedEvent e) { + + } + + @SubscribeEvent + public void onTick(TickEvent.ClientTickEvent e) { + + } + + @Override + public int getRequiredPermissionLevel() { + return 0; + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java new file mode 100644 index 00000000..ab3f8519 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/AColor.java @@ -0,0 +1,9 @@ +package kr.syeyoung.dungeonsguide.config.types; + +import java.awt.*; + +public class AColor extends Color { + public AColor(int r, int g, int b, int a) { + super(r, g, b, a); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java new file mode 100644 index 00000000..e3db0d12 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/config/types/TCAColor.java @@ -0,0 +1,23 @@ +package kr.syeyoung.dungeonsguide.config.types; + +import com.google.gson.JsonElement; +import com.google.gson.JsonPrimitive; + +import java.awt.*; + +public class TCAColor implements TypeConverter<Color> { + @Override + public String getTypeString() { + return "color"; + } + + @Override + public Color deserialize(JsonElement element) { + return new Color(element.getAsInt()); + } + + @Override + public JsonElement serialize(Color element) { + return new JsonPrimitive(element.getRGB()); + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java index 962e9350..3165f462 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureBoxSkelemaster.java @@ -2,6 +2,7 @@ package kr.syeyoung.dungeonsguide.features.impl; import com.google.common.base.Predicate; import kr.syeyoung.dungeonsguide.SkyblockStatus; +import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.e; import kr.syeyoung.dungeonsguide.features.FeatureParameter; import kr.syeyoung.dungeonsguide.features.SimpleFeature; @@ -21,7 +22,7 @@ public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderL public FeatureBoxSkelemaster() { super("Dungeon", "Box Skeleton Masters", "Box skeleton masters in dungeons", "dungeon.skeletonmasterbox", true); parameters.put("radius", new FeatureParameter<Integer>("radius", "Highlight Radius", "The maximum distance between player and skeletonmaster to be boxed", 20, "integer")); - parameters.put("color", new FeatureParameter<Color>("color", "Highlight Color", "Highlight Color of Skeleton master", Color.red, "color")); + parameters.put("color", new FeatureParameter<AColor>("color", "Highlight Color", "Highlight Color of Skeleton master", new AColor(255,0,0,50), "acolor")); } @@ -43,9 +44,8 @@ public class FeatureBoxSkelemaster extends SimpleFeature implements WorldRenderL } }); Color c = this.<Color>getParameter("color").getValue(); - Color real = new Color(c.getRGB() & 0xFFFFFF | 0x44000000, true); for (EntityArmorStand entitySkeleton : skeletonList) { - RenderUtils.highlightBox(entitySkeleton, real, partialTicks, false); + RenderUtils.highlightBox(entitySkeleton, c, partialTicks, false); } } } diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java index 517b668b..d3792e77 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureChestPrice.java @@ -39,6 +39,7 @@ public class FeatureChestPrice extends SimpleFeature implements GuiBackgroundRen GlStateManager.disableLighting(); ContainerChest chest = (ContainerChest) ((GuiChest) rendered.gui).inventorySlots; + if (!chest.getLowerChestInventory().getName().endsWith("Chest")) return; IInventory actualChest = chest.getLowerChestInventory(); int chestPrice = 0; diff --git a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java index a95ed5d2..444cd85a 100644 --- a/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/features/impl/FeatureDungeonScore.java @@ -29,6 +29,7 @@ public class FeatureDungeonScore extends GuiFeature { if (!skyblockStatus.isOnDungeon()) return; FontRenderer fr = getFontRenderer(); ScoreCalculation score = calculateScore(); + if (score == null) return; int sum = score.time + score.skill + score.explorer + score.bonus; if (this.<Boolean>getParameter("verbose").getValue()) { String req = buildRequirement(score); diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java new file mode 100755 index 00000000..1dc52921 --- /dev/null +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditAColor.java @@ -0,0 +1,309 @@ +package kr.syeyoung.dungeonsguide.roomedit.valueedit; + +import kr.syeyoung.dungeonsguide.config.types.AColor; +import kr.syeyoung.dungeonsguide.roomedit.MPanel; +import kr.syeyoung.dungeonsguide.roomedit.Parameter; +import kr.syeyoung.dungeonsguide.roomedit.elements.MColor; +import kr.syeyoung.dungeonsguide.roomedit.elements.MFloatSelectionButton; +import kr.syeyoung.dungeonsguide.roomedit.elements.MLabelAndElement; +import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.util.MathHelper; +import org.lwjgl.opengl.GL11; + +import java.awt.*; + +public class ValueEditAColor extends MPanel implements ValueEdit<AColor> { + private Parameter parameter; + private final MFloatSelectionButton h; + private final MFloatSelectionButton s; + private final MFloatSelectionButton v; + private final MFloatSelectionButton a; + + + @Override + public void renderWorld(float partialTicks) { + + } + public ValueEditAColor(final Parameter parameter2) { + this.parameter = parameter2; + { + MColor color = new MColor() { + @Override + public Color getColor() { + return (Color) parameter2.getPreviousData(); + } + }; + MLabelAndElement mLabelAndElement = new MLabelAndElement("Prev",color); + mLabelAndElement.setBounds(new Rectangle(0,0,getBounds().width,20)); + add(mLabelAndElement); + } + { + MColor color = new MColor() { + @Override + public Color getColor() { + return (Color) parameter2.getNewData(); + } + }; + MLabelAndElement mLabelAndElement = new MLabelAndElement("New",color); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); + add(mLabelAndElement); + } + + Color color = (Color) parameter2.getNewData(); + Color.RGBtoHSB(color.getRed(), color.getGreen(), color.getBlue(), hsv); + + { + h = new MFloatSelectionButton(hsv[0] * 360); + h.setOnUpdate(new Runnable() { + @Override + public void run() { + hsv[0] = h.getData() / 360; + update(); + } + }); + MLabelAndElement mLabelAndElement = new MLabelAndElement("H", h); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); + add(mLabelAndElement); + } + { + s = new MFloatSelectionButton(hsv[1] * 100); + s.setOnUpdate(new Runnable() { + @Override + public void run() { + hsv[1] = s.getData() / 100; + update(); + } + }); + MLabelAndElement mLabelAndElement = new MLabelAndElement("S", s); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); + add(mLabelAndElement); + } + { + v = new MFloatSelectionButton(hsv[2] * 100); + v.setOnUpdate(new Runnable() { + @Override + public void run() { + hsv[2] = v.getData() / 100; + update(); + } + }); + MLabelAndElement mLabelAndElement = new MLabelAndElement("V", v); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); + add(mLabelAndElement); + } + { + a = new MFloatSelectionButton(alpha * 100); + a.setOnUpdate(new Runnable() { + @Override + public void run() { + alpha = v.getData() / 100; + update(); + } + }); + MLabelAndElement mLabelAndElement = new MLabelAndElement("V", v); + mLabelAndElement.setBounds(new Rectangle(0,20,getBounds().width,20)); + add(mLabelAndElement); + } + } + + private float[] hsv = new float[3]; + private float alpha; + + public void update() { + if (hsv[2] > 1) hsv[2] = 1; + if (hsv[2] < 0) hsv[2] = 0; + if (hsv[1] > 1) hsv[1] = 1; + if (hsv[1] < 0) hsv[1] = 0; + parameter.setNewData(new Color(Color.HSBtoRGB(hsv[0], hsv[1], hsv[2]))); + h.setData((float) Math.floor(hsv[0] * 360)); + s.setData((float) Math.floor(hsv[1] * 100)); + v.setData((float) Math.floor(hsv[2] * 100)); + h.updateSelected(); + s.updateSelected(); + v.updateSelected(); + } + @Override + public void render(int absMousex, int absMousey, int relMousex0, int relMousey0, float partialTicks, Rectangle scissor) { + // draw CoolRect + int width = getBounds().width - 60; + Tessellator tessellator = Tessellator.getInstance(); + WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + int shademodel = GL11.glGetInteger(GL11.GL_SHADE_MODEL); + GL11.glShadeModel(GL11.GL_SMOOTH); + GL11.glEnable(GL11.GL_BLEND); + GL11.glDisable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_CULL_FACE); + GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); +// worldrenderer.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); + + int rgb = Color.HSBtoRGB(hsv[0], hsv[1], 1); + float r = (rgb >> 16 & 255) / 255.0f; + float g = (rgb >> 8 & 255) / 255.0f; + float b = (rgb & 255) / 255.0f; + GL11.glBegin(GL11.GL_TRIANGLES); + GL11.glColor4f(0,0,0,1);GL11.glVertex3i(25+width ,45, 0); + GL11.glColor4f(0,0,0,1);GL11.glVertex3i(10+width , 45, 0); + GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); + + GL11.glColor4f(0,0,0,1); GL11.glVertex3i(10+width , 45, 0); + GL11.glColor4f(r,g,b,1);GL11.glVertex3i(10+width , 45 + width, 0); + GL11.glColor4f(r,g,b,1);GL11.glVertex3i(25+width , 45+width, 0); + GL11.glEnd(); + + GL11.glBegin(GL11.GL_TRIANGLES); + GL11.glColor4f(r,g,b,0);GL11.glVertex3i(50+width ,45, 0); + GL11.glColor4f(r,g,b,0);GL11.glVertex3i(35+width , 45, 0); + GL11.glColor4f(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); + + GL11.glColor4f(r,g,b,0); GL11.glVertex3i(35+width , 45, 0); + GL11.glColor4f(r,g,b,1);GL11.glVertex3i(35+width , 45 + width, 0); + GL11.glColor4f(r,g,b,1);GL11.glVertex3i(50+width , 45+width, 0); + GL11.glEnd(); + + + float radius = width/2f; + float cx = 5 + radius; + float cy = 45 + radius; + + GL11.glBegin(GL11.GL_TRIANGLE_FAN); + GL11.glColor4f(1,1,1,1); + GL11.glVertex3f(cx,cy,0); + for (int i = 0; i <= 360; i++) { + float rad = 3.141592653f * i / 180; + int rgb2 = Color.HSBtoRGB(i / 360f, 1, hsv[2]); + float r2 = (rgb2 >> 16 & 255) / 255.0f; + float g2 = (rgb2 >> 8 & 255) / 255.0f; + float b2 = (rgb2 & 255) / 255.0f; + GL11.glColor4f(r2,g2,b2, 1); + GL11.glVertex3f(MathHelper.cos(rad) * radius + cx, MathHelper.sin(rad) * radius + cy, 0); + } + GL11.glEnd(); + GL11.glShadeModel(shademodel); + + GL11.glColor4f(1,1,1,1); + worldrenderer.begin(GL11.GL_LINE_LOOP, DefaultVertexFormats.POSITION); + float rad2 = 2 * 3.141592653f * hsv[0] ; + float x = 5 + radius + (MathHelper.cos(rad2)) * hsv[1] * radius; + float y = 45 + radius + (MathHelper.sin(rad2))* hsv[1] * radius; + for (int i = 0; i < 100; i++) { + float rad = 2 * 3.141592653f * (i / 100f); + worldrenderer.pos(MathHelper.sin(rad) * 2 + x, MathHelper.cos(rad) * 2 + y, 0).endVertex(); + } + tessellator.draw(); + + worldrenderer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION); + worldrenderer.pos(8+width, 45 + (hsv[2]) * width, 0.5).endVertex(); + worldrenderer.pos(27+width, 45 + (hsv[2]) * width, 0.5).endVertex(); + tessellator.draw(); + + GL11.glEnable(GL11.GL_TEXTURE_2D); + GL11.glDisable(GL11.GL_BLEND); + GL11.glColor4f(1,1,1,1); + GlStateManager.color(1,1,1,1); + } + private int selected = 0; + + @Override + public void mouseClicked(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int mouseButton) { + int width = getBounds().width - 60; + float radius = width / 2f; + float circleX = 5 + radius; + float circleY = 45 + radius; + selected = 0; + { + // check circle + float dx = relMouseX - circleX; + float dy = circleY - relMouseY; + if (dx * dx + dy * dy <= radius * radius) { + double theta = (MathHelper.atan2(dx, dy) / Math.PI * 180 + 270) % 360; + hsv[0] = (float) theta / 360f; + hsv[1] = MathHelper.sqrt_float(dx * dx + dy * dy) / radius; + selected = 1; + } + } + { + if (10+width <= relMouseX && relMouseX <= 25 + width && + 45 <= relMouseY && relMouseY <= 45 + width) { + hsv[2] = (relMouseY - 45) / (float)width; + selected = 2; + } + } + { + if (35+width <= relMouseX && relMouseX <= 50 + width && + 45 <= relMouseY && relMouseY <= 45 + width) { + hsv[2] = (relMouseY - 45) / (float)width; + selected = 3; + } + } + update(); + } + + @Override + public void mouseClickMove(int absMouseX, int absMouseY, int relMouseX, int relMouseY, int clickedMouseButton, long timeSinceLastClick) { + int width = getBounds().width - 30; + float radius = width / 2f; + float circleX = 5 + radius; + float circleY = 45 + radius; + { + // check circle + float dx = relMouseX - circleX; + float dy = circleY - relMouseY; + if (selected == 1) { + double theta = (MathHelper.atan2(dx, dy) / Math.PI * 180 + 270) % 360; + hsv[0] = (float) theta / 360f; + hsv[1] = MathHelper.clamp_float(MathHelper.sqrt_float(dx * dx + dy * dy) / radius, 0, 1); + } + } + { + if (selected == 2) { + hsv[2] = MathHelper.clamp_float((relMouseY - 45) / (float)width, 0, 1); + } + if (selected == 3) { + alpha = MathHelper.clamp_float((relMouseY - 45) / (float)width, 0, 1); + } + } + update(); + } + + @Override + public void onBoundsUpdate() { + int cnt = 0; + for (MPanel panel :getChildComponents()){ + panel.setSize(new Dimension(getBounds().width, 20)); cnt++; + if (cnt > 2) { + panel.setPosition(new Point(0, getBounds().width + (cnt - 3) * 20)); + } + } + } + + @Override + public void setParameter(Parameter parameter) { + this.parameter = parameter; + } + + @Override + public void resize(int parentWidth, int parentHeight) { + this.setBounds(new Rectangle(0,0,parentWidth, parentHeight)); + } + + public static class Generator implements ValueEditCreator<ValueEditAColor> { + + @Override + public ValueEditAColor createValueEdit(Parameter parameter) { + return new ValueEditAColor(parameter); + } + + @Override + public Object createDefaultValue(Parameter parameter) { + return 0; + } + + @Override + public Object cloneObj(Object object) { + return object; + } + } +} diff --git a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java index 5605f996..001f5bc7 100755 --- a/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java +++ b/src/main/java/kr/syeyoung/dungeonsguide/roomedit/valueedit/ValueEditRegistry.java @@ -1,5 +1,6 @@ package kr.syeyoung.dungeonsguide.roomedit.valueedit; +import kr.syeyoung.dungeonsguide.config.types.AColor; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPoint; import kr.syeyoung.dungeonsguide.dungeon.data.OffsetPointSet; import kr.syeyoung.dungeonsguide.dungeon.mechanics.*; @@ -30,6 +31,7 @@ public class ValueEditRegistry { valueEditMap.put(OffsetPoint.class.getName(), new ValueEditOffsetPoint.Generator()); valueEditMap.put(OffsetPointSet.class.getName(), new ValueEditOffsetPointSet.Generator()); valueEditMap.put(Color.class.getName(), new ValueEditColor.Generator()); + valueEditMap.put(AColor.class.getName(), new ValueEditAColor.Generator()); valueEditMap.put(DungeonSecret.class.getName(), new ValueEditSecret.Generator()); |