Loki ring now highlights center pos in bold even when not building a new list of cursors

This commit is contained in:
Vincent Lee committed 2020-02-15 19:58:32 -06:00
1 parent 162519dba3
commit 3ccbef5c16
3 files changed
+19 -7

No files matched your search

@@ -14,6 +14,7 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
import javax.annotation.Nullable;
import java.util.List;
/**
@@ -34,7 +35,10 @@ public interface IWireframeCoordinateListProvider {
* This is useful to indicate the precedence of some position over the others.
* @return The position of a single wireframe to draw thicker than all the others.
*/
public BlockPos getSourceWireframe(PlayerEntity player, ItemStack stack);
@Nullable
default BlockPos getSourceWireframe(PlayerEntity player, ItemStack stack) {
return null;
}
}
@@ -182,8 +182,21 @@ public class ItemLokiRing extends ItemRelicBauble implements IWireframeCoordinat
}
@Override
@OnlyIn(Dist.CLIENT)
public BlockPos getSourceWireframe(PlayerEntity player, ItemStack stack) {
return getLokiRing(player) == stack ? getOriginPos(stack) : null;
Minecraft mc = Minecraft.getInstance();
if (getLokiRing(player) == stack) {
BlockPos currentBuildCenter = getOriginPos(stack);
if (currentBuildCenter.getY() != -1) {
return currentBuildCenter;
} else if (mc.objectMouseOver instanceof BlockRayTraceResult
&& mc.objectMouseOver.getType() == RayTraceResult.Type.BLOCK
&& !getCursorList(stack).isEmpty()) {
return ((BlockRayTraceResult) mc.objectMouseOver).getPos();
}
}
return null;
}
private static ItemStack getLokiRing(PlayerEntity player) {
@@ -384,9 +384,4 @@ public class ItemExchangeRod extends ItemMod implements IManaUsingItem, IWirefra
return ImmutableList.of();
}
@Override
public BlockPos getSourceWireframe(PlayerEntity player, ItemStack stack) {
return null;
}
}