aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java458
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java9
2 files changed, 404 insertions, 63 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
index e959c761..16a40290 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/miscfeatures/CustomItemEffects.java
@@ -44,6 +44,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
+import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompressedStreamTools;
import net.minecraft.nbt.NBTTagCompound;
@@ -67,6 +68,7 @@ import org.lwjgl.util.vector.Vector3f;
import java.awt.*;
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedList;
@@ -334,7 +336,7 @@ public class CustomItemEffects {
}
boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals(
- "dynamic");
+ "dynamic") || SBInfo.getInstance().getLocation().equals("garden");
if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay &&
Minecraft.getMinecraft().objectMouseOver != null &&
@@ -346,7 +348,7 @@ public class CustomItemEffects {
Minecraft.getMinecraft().objectMouseOver.sideHit, 1));
if (hover.getBlock() == Blocks.air) {
- if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) {
+ if (heldInternal != null && (heldInternal.equals("BUILDERS_WAND") || heldInternal.equals("BUILDERS_RULER"))) {
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
HashSet<BlockPos> candidatesOld = new HashSet<>();
@@ -356,7 +358,10 @@ public class CustomItemEffects {
world.getBlockState(Minecraft.getMinecraft().objectMouseOver.getBlockPos());
Item matchItem = Item.getItemFromBlock(match.getBlock());
if (matchItem != null) {
- ItemStack matchStack = new ItemStack(matchItem, 1,
+ boolean ruler = heldInternal.equals("BUILDERS_RULER");
+ ItemStack matchStack;
+
+ matchStack = new ItemStack(matchItem, 1,
match
.getBlock()
.getDamageValue(
@@ -364,44 +369,67 @@ public class CustomItemEffects {
Minecraft.getMinecraft().objectMouseOver.getBlockPos()
)
);
+ if (ruler) {
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking()) matchStack = getFirstItemInRuler();
+ match = Blocks.dirt.getDefaultState();
+ }
+ if (matchStack == null) return;
- getBuildersWandCandidates(
- Minecraft.getMinecraft().thePlayer,
- Minecraft.getMinecraft().objectMouseOver,
- event.partialTicks,
- candidatesOld,
- candidatesOldSorted,
- 999 - MAX_BUILDERS_BLOCKS
- );
+ if (heldInternal.equals("BUILDERS_WAND")) {
+ getBuildersWandCandidates(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().objectMouseOver,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 999 - MAX_BUILDERS_BLOCKS
+ );
+ } else {
+ getBuildersRulerCandidates(
+ Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().objectMouseOver,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 199 - MAX_BUILDERS_BLOCKS
+ );
+ }
boolean usingDirtWand = false;
int itemCount;
- if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ if (Minecraft.getMinecraft().thePlayer.isSneaking() && ruler) {
itemCount = candidatesOld.size();
- usingDirtWand = true;
} else {
- itemCount = countItemsInInventoryAndStorage(matchStack);
+ if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ itemCount = candidatesOld.size();
+ usingDirtWand = true;
+ } else {
+ itemCount = countItemsInInventoryAndStorage(matchStack);
+ }
}
-
- if (candidatesOld.size() > MAX_BUILDERS_BLOCKS) {
- Utils.drawStringCentered(
- EnumChatFormatting.RED.toString() + candidatesOld.size() + "/" + MAX_BUILDERS_BLOCKS,
- Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2f,
- scaledResolution.getScaledHeight() / 2f + 10,
- true,
- 0
- );
- } else {
- String pre = EnumChatFormatting.GREEN.toString();
- if (itemCount < candidatesOld.size()) {
- pre = EnumChatFormatting.RED.toString();
+ if (candidatesOld.size() == 0) return;
+
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking() || !ruler) {
+ if (candidatesOld.size() > MAX_BUILDERS_BLOCKS) {
+ Utils.drawStringCentered(
+ EnumChatFormatting.RED.toString() + candidatesOld.size() + "/" + MAX_BUILDERS_BLOCKS,
+ Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth() / 2f,
+ scaledResolution.getScaledHeight() / 2f + 10,
+ true,
+ 0
+ );
+ } else {
+ String pre = EnumChatFormatting.GREEN.toString();
+ if (itemCount < candidatesOld.size() && !ruler) {
+ pre = EnumChatFormatting.RED.toString();
+ }
+ Utils.drawStringCentered(pre + Math.min(candidatesOld.size(), itemCount) + "/" +
+ Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS),
+ Minecraft.getMinecraft().fontRendererObj,
+ scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0
+ );
}
- Utils.drawStringCentered(pre + Math.min(candidatesOld.size(), itemCount) + "/" +
- Math.min(candidatesOld.size(), MAX_BUILDERS_BLOCKS),
- Minecraft.getMinecraft().fontRendererObj,
- scaledResolution.getScaledWidth() / 2f, scaledResolution.getScaledHeight() / 2f + 10, true, 0
- );
}
String itemCountS = EnumChatFormatting.DARK_GRAY + "x" + EnumChatFormatting.RESET + itemCount;
@@ -497,6 +525,7 @@ public class CustomItemEffects {
}
public int countItemsInInventoryAndStorage(ItemStack match) {
+ if (match == null) return 0;
int count = 0;
for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
@@ -508,10 +537,15 @@ public class CustomItemEffects {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
- if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) {
+ boolean isWand = heldInternal != null && heldInternal.equals("BUILDERS_WAND");
+ if (heldInternal != null && heldInternal.equals(isWand ? "BUILDERS_WAND" : "BUILDERS_RULER")) {
if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) &&
- held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("builder's_wand_data", 7)) {
- byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray("builder's_wand_data");
+ held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data", 7)) {
+ byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data");
try {
NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
NBTTagList items = contents_nbt.getTagList("i", 10);
@@ -533,6 +567,44 @@ public class CustomItemEffects {
return count;
}
+ public ItemStack getFirstItemInRuler() {
+ int count = 0;
+
+ ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
+ String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
+
+ if (heldInternal != null && heldInternal.equals("BUILDERS_RULER")) {
+ if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) &&
+ held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("builder's_ruler_data", 7)) {
+ byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray("builder's_ruler_data");
+ try {
+ NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
+ NBTTagList items = contents_nbt.getTagList("i", 10);
+ for (int j = 0; j < items.tagCount(); j++) {
+ NBTTagCompound buildersItem = items.getCompoundTagAt(j);
+ if (buildersItem.getKeySet().size() > 0) {
+ ItemStack newStack = new ItemStack(
+ Item.getItemById(buildersItem.getInteger("id")),
+ 1,
+ buildersItem.getInteger("Damage")
+ );
+ return newStack;
+ }
+ }
+ } catch (Exception e) {
+ return null;
+ }
+ }
+ }
+
+ //the ruler says it uses ur inv but it doesnt
+ /*for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
+ if (stack != null && stack.getItem() instanceof ItemBlock) return stack;
+ }*/
+
+ return null;
+ }
+
public boolean hasDirtWand() {
for (ItemStack stack : Minecraft.getMinecraft().thePlayer.inventory.mainInventory) {
String internalname = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(stack);
@@ -543,11 +615,15 @@ public class CustomItemEffects {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
-
- if (heldInternal != null && heldInternal.equals("BUILDERS_WAND")) {
+ boolean isWand = heldInternal != null && heldInternal.equals("BUILDERS_WAND");
+ if (heldInternal != null && heldInternal.equals(isWand ? "BUILDERS_WAND" : "BUILDERS_RULER")) {
if (held.hasTagCompound() && held.getTagCompound().hasKey("ExtraAttributes", 10) &&
- held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey("builder's_wand_data", 7)) {
- byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray("builder's_wand_data");
+ held.getTagCompound().getCompoundTag("ExtraAttributes").hasKey(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data", 7)) {
+ byte[] bytes = held.getTagCompound().getCompoundTag("ExtraAttributes").getByteArray(isWand
+ ? "builder's_wand_data"
+ : "builder's_ruler_data");
try {
NBTTagCompound contents_nbt = CompressedStreamTools.readCompressed(new ByteArrayInputStream(bytes));
NBTTagList items = contents_nbt.getTagList("i", 10);
@@ -597,6 +673,10 @@ public class CustomItemEffects {
add(Blocks.farmland);
}};
+
+ List<Block> scytheBlocks = Arrays.asList(
+ Blocks.leaves, Blocks.leaves2, Blocks.red_flower, Blocks.yellow_flower, Blocks.tallgrass, Blocks.double_plant);
+
@SubscribeEvent
public void renderBlockOverlay(DrawBlockHighlightEvent event) {
if (aoteTeleportationCurr != null && aoteTeleportationMillis > 0) {
@@ -612,7 +692,7 @@ public class CustomItemEffects {
String heldInternal = NotEnoughUpdates.INSTANCE.manager.getInternalNameForItem(held);
if (heldInternal != null) {
boolean onPrivateIsland = SBInfo.getInstance().getLocation() == null || SBInfo.getInstance().getLocation().equals(
- "dynamic");
+ "dynamic") || SBInfo.getInstance().getLocation().equals("garden");
EntityPlayer player = event.player;
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) event.partialTicks;
double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) event.partialTicks;
@@ -834,7 +914,7 @@ public class CustomItemEffects {
GlStateManager.disableBlend();
}
} else if (NotEnoughUpdates.INSTANCE.config.itemOverlays.enableWandOverlay) {
- if (heldInternal.equals("BUILDERS_WAND") && onPrivateIsland) {
+ if ((heldInternal.equals("BUILDERS_WAND") || heldInternal.equals("BUILDERS_RULER")) && onPrivateIsland) {
int maxBlocks = MAX_BUILDERS_BLOCKS;
if (event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
IBlockState hover = Minecraft.getMinecraft().theWorld.getBlockState(event.target
@@ -852,37 +932,72 @@ public class CustomItemEffects {
HashSet<BlockPos> candidatesOld = new HashSet<>();
TreeMap<Float, Set<BlockPos>> candidatesOldSorted = new TreeMap<>();
- getBuildersWandCandidates(
- player,
- event.target,
- event.partialTicks,
- candidatesOld,
- candidatesOldSorted,
- 10
- );
+ boolean ruler = heldInternal.equals("BUILDERS_RULER");
- ItemStack matchStack = new ItemStack(matchItem, 1,
- match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, event.target.getBlockPos())
- );
+ if (!ruler) {
+ getBuildersWandCandidates(
+ player,
+ event.target,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 10
+ );
+ } else {
+ getBuildersRulerCandidates(
+ player,
+ event.target,
+ event.partialTicks,
+ candidatesOld,
+ candidatesOldSorted,
+ 10
+ );
+ if (!Minecraft.getMinecraft().thePlayer.isSneaking()) {
+ Item item = getFirstItemInRuler() == null ? null : getFirstItemInRuler().getItem();
+ if (item != null) {
+ if (item instanceof ItemBlock) match = ((ItemBlock) item).getBlock().getStateFromMeta(
+ getFirstItemInRuler().getItemDamage());
+ else match = Blocks.dirt.getDefaultState();
+ }
+ }
+ }
+
+ ItemStack matchStack;
+ if (ruler) {
+ if (Minecraft.getMinecraft().thePlayer.isSneaking()) {
+ matchStack = new ItemStack(Minecraft.getMinecraft().theWorld
+ .getBlockState(event.target.getBlockPos())
+ .getBlock());
+ } else {
+ matchStack = getFirstItemInRuler();
+ }
+ } else {
+
+ matchStack = new ItemStack(matchItem, 1,
+ match.getBlock().getDamageValue(Minecraft.getMinecraft().theWorld, event.target.getBlockPos())
+ );
+ }
int itemCount;
- if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
- itemCount = candidatesOld.size();
+ if (matchStack != null) {
+ if (match.getBlock() == Blocks.dirt && matchStack.getItemDamage() == 0 && hasDirtWand()) {
+ itemCount = candidatesOld.size();
+ } else {
+ itemCount = countItemsInInventoryAndStorage(matchStack);
+ }
} else {
- itemCount = countItemsInInventoryAndStorage(matchStack);
+ return;
}
String special = (candidatesOld.size() <= itemCount)
- ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour
- :
- "0:255:255:0:0";
+ ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour : "0:255:255:0:0";
- if (candidatesOld.size() <= maxBlocks) {
+ if (candidatesOld.size() <= maxBlocks || ruler) {
for (Set<BlockPos> candidatesSorted : candidatesOldSorted.values()) {
for (BlockPos candidate : candidatesSorted) {
match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate);
AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(
Minecraft.getMinecraft().theWorld,
- candidate
+ candidate.add(0, Minecraft.getMinecraft().thePlayer.isSneaking() && ruler ? -1 : 0, 0)
)
.offset(
event.target.sideHit.getFrontOffsetX(),
@@ -898,7 +1013,7 @@ public class CustomItemEffects {
match.getBlock().setBlockBoundsBasedOnState(Minecraft.getMinecraft().theWorld, candidate);
AxisAlignedBB bb = match.getBlock().getSelectedBoundingBox(
Minecraft.getMinecraft().theWorld,
- candidate
+ candidate.add(0, Minecraft.getMinecraft().thePlayer.isSneaking() && ruler ? -1 : 0, 0)
)
.expand(0.001D, 0.001D, 0.001D).offset(-d0, -d1, -d2)
.offset(
@@ -907,7 +1022,9 @@ public class CustomItemEffects {
event.target.sideHit.getFrontOffsetZ()
);
- drawOutlineBoundingBox(bb, 1f, special);
+ drawOutlineBoundingBox(bb, 1f,
+ (ruler && Minecraft.getMinecraft().thePlayer.isSneaking())
+ ? NotEnoughUpdates.INSTANCE.config.itemOverlays.wandOverlayColour : special);
}
}
@@ -1071,6 +1188,114 @@ public class CustomItemEffects {
GlStateManager.enableTexture2D();
GlStateManager.disableBlend();
}
+ } else if ((heldInternal.equals("HOE_OF_GREATEST_TILLING") &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.enableHoeOverlay && onPrivateIsland) &&
+ event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ BlockPos target = event.target.getBlockPos();
+ IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target);
+
+ if (targetState.getBlock() == Blocks.dirt || targetState.getBlock() == Blocks.grass) {
+ GlStateManager.enableDepth();
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.disableTexture2D();
+ GlStateManager.depthMask(true);
+
+ LinkedList<BlockPos> candidates = new LinkedList<>();
+ LinkedList<BlockPos> candidatesOld = new LinkedList<>();
+ LinkedList<BlockPos> candidatesNew = new LinkedList<>();
+ candidatesNew.add(target);
+
+ while (candidatesOld.size() <= 100) {
+ if (candidatesNew.isEmpty()) {
+ break;
+ }
+
+ candidates.addAll(candidatesNew);
+ candidatesNew.clear();
+
+ while (!candidates.isEmpty()) {
+
+ BlockPos candidate = candidates.pop();
+ candidatesOld.add(candidate);
+
+ float yaw = Minecraft.getMinecraft().thePlayer.getRotationYawHead();
+ Facing facing = Facing.forDirection(yaw);
+ int xOff = facing == Facing.WEST ? -1 : facing == Facing.EAST ? 1 : 0;
+ int zOff = facing == Facing.NORTH ? -1 : facing == Facing.SOUTH ? 1 : 0;
+
+ BlockPos renderPos = candidate.add(xOff, 0, zOff);
+ IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos);
+ if (!candidatesOld.contains(renderPos) && !candidates.contains(renderPos) && !candidatesNew.contains(
+ renderPos)) {
+ if (renderState.getBlock() == Blocks.dirt || renderState.getBlock() == Blocks.grass) {
+ candidatesNew.add(renderPos);
+ } else {
+ break;
+ }
+ }
+ }
+
+ for (BlockPos renderPos : candidatesNew) {
+ AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(
+ Minecraft.getMinecraft().theWorld,
+ renderPos
+ )
+ .expand(0.001D, 0.001D, 0.001D)
+ .offset(-d0, -d1, -d2);
+ drawFilledBoundingBox(bbExpanded, 1f, "0:100:178:34:34");
+ }
+ }
+
+ AxisAlignedBB bbExpanded = Blocks.dirt.getSelectedBoundingBox(
+ Minecraft.getMinecraft().theWorld,
+ target
+ )
+ .expand(0.001D, 0.001D, 0.001D)
+ .offset(-d0, -d1, -d2);
+ drawFilledBoundingBox(bbExpanded, 1f, "0:100:178:34:34");
+
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
+ } else if ((heldInternal.equals("SAM_SCYTHE") || heldInternal.equals("GARDEN_SCYTHE") &&
+ NotEnoughUpdates.INSTANCE.config.itemOverlays.enableScytheOverlay && onPrivateIsland) &&
+ event.target.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
+ BlockPos target = event.target.getBlockPos();
+ IBlockState targetState = Minecraft.getMinecraft().theWorld.getBlockState(target);
+
+ int radius = heldInternal.equals("SAM_SCYTHE") ? 1 : 2;
+
+ if (scytheBlocks.contains(targetState.getBlock())) {
+ GlStateManager.enableDepth();
+ GlStateManager.enableBlend();
+ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GlStateManager.disableTexture2D();
+ GlStateManager.depthMask(true);
+
+ for (int xOff = -radius; xOff <= radius; xOff++) {
+ for (int yOff = -radius; yOff <= radius; yOff++) {
+ for (int zOff = -radius; zOff <= radius; zOff++) {
+ BlockPos renderPos = target.add(xOff, yOff, zOff);
+ IBlockState renderState = Minecraft.getMinecraft().theWorld.getBlockState(renderPos);
+ if (scytheBlocks.contains(renderState.getBlock())) {
+ AxisAlignedBB bbExpanded = renderState.getBlock().getSelectedBoundingBox(
+ Minecraft.getMinecraft().theWorld,
+ renderPos
+ )
+ .expand(0.001D, 0.001D, 0.001D)
+ .offset(-d0, -d1, -d2);
+ drawFilledBoundingBox(bbExpanded, 1f, "0:100:178:34:34");
+ }
+ }
+ }
+ }
+
+ GlStateManager.depthMask(true);
+ GlStateManager.enableTexture2D();
+ GlStateManager.disableBlend();
+ }
}
}
}
@@ -1144,6 +1369,113 @@ public class CustomItemEffects {
}
}
+ public enum Facing {
+ NORTH,
+ EAST,
+ SOUTH,
+ WEST;
+
+ public static Facing forDirection(float direction) {
+ double rotation = (direction - 90) % 360;
+ if (rotation < 0) {
+ rotation += 360.0;
+ }
+
+ if ((0.0D <= rotation) && (rotation < 45.0D))
+ return WEST;
+ if ((45.0D <= rotation) && (rotation < 135.0D))
+ return NORTH;
+ if ((135.0D <= rotation) && (rotation < 225.0D))
+ return EAST;
+ if ((225.0D <= rotation) && (rotation < 315.0D))
+ return SOUTH;
+ if ((315.0D <= rotation) && (rotation < 360.0D)) {
+ return WEST;
+ } else {
+ return NORTH; // it uhhh shouldnt do this tho right
+ }
+ }
+ }
+
+ public void getBuildersRulerCandidates(
+ EntityPlayer player,
+ MovingObjectPosition target,
+ float partialTicks,
+ HashSet<BlockPos> candidatesOld,
+ TreeMap<Float, Set<BlockPos>> candidatesOldSorted,
+ int extraMax
+ ) {
+ if (target.sideHit != EnumFacing.UP) return;
+ boolean sneaking = Minecraft.getMinecraft().thePlayer.isSneaking();
+ candidatesOld.clear();
+ candidatesOldSorted.clear();
+ LinkedList<BlockPos> candidates = new LinkedList<>();
+ LinkedList<BlockPos> candidatesNew = new LinkedList<>();
+
+ candidatesNew.add(target.getBlockPos());
+
+ double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
+ double d1 = player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks;
+ double d2 = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks;
+
+ while (candidatesOld.size() <= MAX_BUILDERS_BLOCKS + extraMax) {
+ if (candidatesNew.isEmpty()) {
+ break;
+ }
+
+ candidates.addAll(candidatesNew);
+ candidatesNew.clear();
+
+ while (!candidates.isEmpty()) {
+ if (candidatesOld.size() > MAX_BUILDERS_BLOCKS + extraMax) break;
+
+ BlockPos candidate = candidates.pop();
+
+ float distSq = (float) ((candidate.getX() + 0.5f - d0) * (candidate.getX() + 0.5f - d0) +
+ (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) *
+ (candidate.getY() + 0.5f - d1 - player.getEyeHeight()) +
+ (candidate.getZ() + 0.5f - d2) * (candidate.getZ() + 0.5f - d2));
+ candidatesOldSorted.computeIfAbsent(distSq, k -> new HashSet<>()).add(candidate);
+
+ candidatesOld.add(candidate);
+
+ float yaw = Minecraft.getMinecraft().thePlayer.getRotationYawHead();
+ Facing facing = Facing.forDirection(yaw);
+ int xOff = facing == Facing.WEST ? -1 : facing == Facing.EAST ? 1 : 0;
+ int zOff = facing == Facing.NORTH ? -1 : facing == Facing.SOUTH ? 1 : 0;
+ if (!sneaking) {
+ if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 1, zOff)).getBlock() == Blocks.air) {
+
+ BlockPos posNew = candidate.add(xOff, 0, zOff);
+ if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) {
+ IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew.add(0, 1, 0));
+ if (blockNew.getBlock() == Blocks.air) {
+ candidatesNew.add(posNew);
+ }
+ }
+ } else {
+ break;
+ }
+ } else {
+ if (Minecraft.getMinecraft().theWorld.getBlockState(candidate.add(xOff, 0, zOff)).getBlock()
+ == Minecraft.getMinecraft().theWorld.getBlockState(target.getBlockPos()).getBlock()) {
+ BlockPos posNew = candidate.add(xOff, 0, zOff);
+ if (!candidatesOld.contains(posNew) && !candidates.contains(posNew) && !candidatesNew.contains(posNew)) {
+ IBlockState blockNew = Minecraft.getMinecraft().theWorld.getBlockState(posNew.add(0, 0, 0));
+ if (blockNew.getBlock() ==
+ Minecraft.getMinecraft().theWorld.getBlockState(target.getBlockPos()).getBlock()) {
+ candidatesNew.add(posNew);
+ }
+ }
+ } else {
+ break;
+ }
+ }
+
+ }
+ }
+ }
+
public static void drawBlock(int x, int y, int z, IBlockState state, float partialTicks, float brightness) {
EntityPlayerSP player = Minecraft.getMinecraft().thePlayer;
double d0 = player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks;
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
index 081fd4b3..96ce838a 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/options/seperateSections/ItemOverlays.java
@@ -377,6 +377,15 @@ public class ItemOverlays {
@ConfigAccordionId(id = 7)
public boolean enableDirtWandOverlay = true;
+ @Expose
+ @ConfigOption(
+ name = "Enable Scythe Overlay",
+ desc = "Show a block overlay for the effected blocks of scythe's ability."
+ )
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 7)
+ public boolean enableScytheOverlay = true;
+
@ConfigOption(
name="Custom Wither Cloak",
desc = ""