-
-
Notifications
You must be signed in to change notification settings - Fork 141
Enderman Slayer Utilities #502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Here is the testing footage: https://youtu.be/CkGuSyab5yw |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small things :)
src/main/java/de/hysky/skyblocker/mixin/ClientPlayNetworkHandlerMixin.java
Outdated
Show resolved
Hide resolved
src/main/java/de/hysky/skyblocker/skyblock/end/BeaconHighlighter.java
Outdated
Show resolved
Hide resolved
|
Made some changes, can you make sure this still works? |
|
There's a merge conflict, so before this can be merged, I need you to do Can you also do a quick test to make sure it still works? |
|
I can't test it tonight, but I can tomorrow. I hope my merge fixes worked. |
091e5c1 to
062e432
Compare
|
Here's an alternative version of the beacon highlighting. It detects when the voidgloom throws the "beacon" and tracks that entity until it despawns, and once it does, it checks a 2x2 radius around where it despawned for the beacon block. Not sure if it's a better approach, but from my testing it is reliable. Code definitely isn't the greatest but it should be very easy to adapt to Skyblocker's style if needed. Codepackage com.khafra.hypixel.features.slayers.voidgloom;
import com.khafra.hypixel.features.hypixel.Locraw;
import java.awt.*;
import java.util.ArrayList;
import me.x150.renderer.render.Renderer3d;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientEntityEvents;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderContext;
import net.fabricmc.fabric.api.client.rendering.v1.WorldRenderEvents;
import net.minecraft.block.Blocks;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.world.ClientWorld;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.EquipmentSlot;
import net.minecraft.entity.decoration.ArmorStandEntity;
import net.minecraft.item.Items;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
public class HighlightBeacon {
private final ArrayList<Beacon> beacons = new ArrayList<>();
public HighlightBeacon() {
ClientEntityEvents.ENTITY_UNLOAD.register(this::onEntityDespawn);
WorldRenderEvents.END.register(this::onWorldRender);
}
private void onWorldRender(WorldRenderContext context) {
if (!this.isEnd() && this.beacons.isEmpty()) return;
var world = MinecraftClient.getInstance().world;
this.beacons.removeIf(beacon -> System.currentTimeMillis() - beacon.age > 2000);
this.beacons.removeIf(
beacon ->
beacon.getBeaconPos() == null
? false
: !world.getBlockState(beacon.getBeaconPos()).isOf(Blocks.BEACON));
for (var entry : this.beacons) {
if (entry.getBeaconPos() == null) continue;
Renderer3d.renderThroughWalls();
Renderer3d.renderEdged(
context.matrixStack(),
Color.MAGENTA,
Color.MAGENTA,
Vec3d.of(entry.getBeaconPos()),
new Vec3d(1, 1, 1));
Renderer3d.stopRenderThroughWalls();
}
}
private void onEntityDespawn(Entity entity, ClientWorld clientWorld) {
if (!this.isEnd()) return;
if (entity.getType() != EntityType.ARMOR_STAND
|| !((ArmorStandEntity) entity).getEquippedStack(EquipmentSlot.HEAD).isOf(Items.BEACON))
return;
this.beacons.add(new Beacon((ArmorStandEntity) entity));
}
private boolean isEnd() {
return Locraw.hasLocraw() && Locraw.getMode().equals("combat_3");
}
public static class Beacon {
private final ArmorStandEntity entity;
private final long age;
private BlockPos blockPos = null;
public Beacon(ArmorStandEntity entity) {
this.entity = entity;
this.age = System.currentTimeMillis();
}
public BlockPos getBeaconPos() {
if (this.blockPos != null || System.currentTimeMillis() - this.age > 500) {
return this.blockPos;
}
var offset = 2;
var entityPos = this.entity.getPos();
for (int xOffset = -offset; xOffset <= offset; xOffset++) {
for (int yOffset = -offset; yOffset <= offset; yOffset++) {
for (int zOffset = -offset; zOffset <= offset; zOffset++) {
var pos = entityPos.add(xOffset, yOffset, zOffset);
var blockPos = BlockPos.ofFloored(pos.getX(), pos.getY(), pos.getZ());
if (MinecraftClient.getInstance().world.getBlockState(blockPos).isOf(Blocks.BEACON)) {
return this.blockPos = blockPos;
}
}
}
}
return null;
}
}
} |
|
IMO your code looks great, though I'd like to ask what others here think of it just to be safe. |
This PR adds 2 Enderman Slayer utilities - Beacon Highlighting & Nukekubi Head highlighting.
Beacon Highlighting
This is the one I'm the least confident in. It checks in a 15x7x15 area around the player every 5 ticks for a beacon, and if there is one, highlight it. It works as needed, the only issue is that the algorithm checks ~1,575 blocks which isn't that expensive, but could be on low-end computers. This can be found in the new
BeaconHighlighterclass.Nukekubi Head Highlighting
This one is very simple - it just applies a glowing effect to armorstand entities with the Nukekubi Head item on their armor slots. This can be found in the
MobGlowclass.This is my first time actually trying to do something useful in Fabric, so I apologize if this isn't as good code as other parts of the mod.