Skip to content

Commit

Permalink
custom beacon color, wait for spoon cd, another particle type, no bea…
Browse files Browse the repository at this point in the history
…con xray (for clarity)
  • Loading branch information
Desco1 committed Jun 18, 2022
1 parent 3b1037f commit 734479b
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 21 deletions.
12 changes: 11 additions & 1 deletion src/main/java/com/luna/synthesis/core/Config.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import net.minecraft.util.EnumChatFormatting;
import net.minecraftforge.fml.common.Loader;

import java.awt.*;
import java.io.File;

public class Config extends Vigilant {
Expand Down Expand Up @@ -607,11 +608,20 @@ public class Config extends Vigilant {
@Property(
type = PropertyType.SWITCH,
name = "Burrow waypoints",
description = "Sets a waypoint at the location calculated by ancestral spade triangulation. Uses Skytils' waypoints.",
description = "Sets a waypoint at the location calculated by ancestral spade triangulation.",
category = "Utilities"
)
public boolean utilitiesAncestralSpadeWaypoint = false;

@Property(
type = PropertyType.COLOR,
name = "Burrow waypoint color",
description = "The color of the waypoint beacon.",
category = "Utilities",
allowAlpha = false
)
public Color utilitiesAncestralSpadeWaypointColor = Color.RED;

@Property(
type = PropertyType.SWITCH,
name = "Parse burrow arrow",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class AncestralSpade {
private final ResourceLocation beaconBeam = new ResourceLocation("textures/entity/beacon_beam.png");
private boolean awaiting = false;
private boolean awaitingForArrow = false;
private long lastSpoon = -1L;
private Vec3 pos1 = null;
private Vec3 pos2 = null;
private Vec3 vec1 = null;
Expand All @@ -36,21 +37,23 @@ public void onPacketReceived(PacketReceivedEvent event) {
if (!config.utilitiesAncestralSpade) return;
if (event.getPacket() instanceof S2APacketParticles) {
S2APacketParticles packet = (S2APacketParticles) event.getPacket();
if (packet.getParticleType() == EnumParticleTypes.ENCHANTMENT_TABLE && packet.getParticleSpeed() == -2 && packet.getParticleCount() == 10) {
if (awaiting) {
if (pos1 == null) {
pos1 = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate());
awaiting = false;
} else if (pos2 == null) {
pos2 = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate());
awaiting = false;
}
} else {
if (vec1 == null && pos1 != null) {
vec1 = new Vec3(packet.getXCoordinate() - pos1.xCoord, packet.getYCoordinate() - pos1.yCoord, packet.getZCoordinate() - pos1.zCoord).normalize();
} else if (vec2 == null && pos2 != null) {
vec2 = new Vec3(packet.getXCoordinate() - pos2.xCoord, packet.getYCoordinate() - pos2.yCoord, packet.getZCoordinate() - pos2.zCoord).normalize();
calculateIntercept();
if (packet.getParticleType() == EnumParticleTypes.FIREWORKS_SPARK && packet.getXOffset() == 0 && packet.getYOffset() == 0 && packet.getZOffset() == 0) {
if (packet.getParticleSpeed() == 0 && packet.getParticleCount() == 1) {
if (awaiting) {
if (pos1 == null) {
pos1 = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate());
awaiting = false;
} else if (pos2 == null) {
pos2 = new Vec3(packet.getXCoordinate(), packet.getYCoordinate(), packet.getZCoordinate());
awaiting = false;
}
} else {
if (vec1 == null && pos1 != null) {
vec1 = new Vec3(packet.getXCoordinate() - pos1.xCoord, packet.getYCoordinate() - pos1.yCoord, packet.getZCoordinate() - pos1.zCoord).normalize();
} else if (vec2 == null && pos2 != null) {
vec2 = new Vec3(packet.getXCoordinate() - pos2.xCoord, packet.getYCoordinate() - pos2.yCoord, packet.getZCoordinate() - pos2.zCoord).normalize();
calculateIntercept();
}
}
}
} else if (packet.getParticleType() == EnumParticleTypes.REDSTONE && packet.getParticleSpeed() == 1 && packet.getParticleCount() == 0) {
Expand All @@ -74,8 +77,11 @@ public void onRightClick(PlayerInteractEvent event) {
ItemStack item = Minecraft.getMinecraft().thePlayer.getHeldItem();
if (item == null) return;
if (StringUtils.stripControlCodes(item.getDisplayName()).contains("Ancestral Spade")) {
if (Minecraft.getMinecraft().thePlayer.rotationPitch == 90 || Minecraft.getMinecraft().thePlayer.rotationPitch == -90) {
awaiting = true;
if (System.currentTimeMillis() >= lastSpoon + 3000) {
if (Minecraft.getMinecraft().thePlayer.rotationPitch == 90 || Minecraft.getMinecraft().thePlayer.rotationPitch == -90) {
awaiting = true;
lastSpoon = System.currentTimeMillis();
}
}
}
}
Expand Down Expand Up @@ -108,10 +114,8 @@ public void onRenderWorld(RenderWorldLastEvent event) {
double renderPosZ = Minecraft.getMinecraft().getRenderManager().viewerPosZ;
GlStateManager.pushMatrix();
GlStateManager.translate(-renderPosX, -renderPosY, -renderPosZ);
GlStateManager.disableDepth();
Minecraft.getMinecraft().getTextureManager().bindTexture(beaconBeam);
Utils.renderBeamSegment(solution.getX(), 0, solution.getZ(), event.partialTicks, 1.0, Minecraft.getMinecraft().theWorld.getTotalWorldTime(), 0, 256, Color.BLUE.getColorComponents(null));
GlStateManager.enableDepth();
Utils.renderBeamSegment(solution.getX(), 0, solution.getZ(), event.partialTicks, 1.0, Minecraft.getMinecraft().theWorld.getTotalWorldTime(), 0, 256, config.utilitiesAncestralSpadeWaypointColor.getColorComponents(null));
GlStateManager.translate(renderPosX, renderPosY, renderPosZ);
GlStateManager.popMatrix();
}
Expand Down

0 comments on commit 734479b

Please sign in to comment.