Skip to content

Commit

Permalink
Exempt Storage Drawers blocks for better placement new location setti…
Browse files Browse the repository at this point in the history
…ng, fixes #416
  • Loading branch information
ACGaming committed Apr 3, 2024
1 parent 530c896 commit b9c5193
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.RayTraceResult.Type;
import net.minecraft.util.math.Vec3d;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent;
import net.minecraftforge.fml.common.gameevent.TickEvent.Phase;
Expand Down Expand Up @@ -46,7 +47,7 @@ public static void utBetterPlacement(TickEvent.ClientTickEvent event)
{
Minecraft.getMinecraft().rightClickDelayTimer = 0;
}
else if (UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementNewLoc && pos.equals(lastTargetPos) && side == lastTargetSide)
else if (UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementNewLoc && pos.equals(lastTargetPos) && side == lastTargetSide && !isDrawer(pos))
{
Minecraft.getMinecraft().rightClickDelayTimer = 4;
}
Expand All @@ -57,4 +58,16 @@ else if (UTConfigTweaks.BLOCKS.BETTER_PLACEMENT.utBetterPlacementNewLoc && pos.e
}
}
}

public static boolean isDrawer(BlockPos pos)
{
try
{
return Loader.isModLoaded("storagedrawers") && Minecraft.getMinecraft().world.getBlockState(pos).getBlock().getRegistryName().getNamespace().equals("storagedrawers");
}
catch (Exception e)
{
return false;
}
}
}

0 comments on commit b9c5193

Please sign in to comment.